dathacky / Serverless-Question-Answering-API

Serverless BERT with Huggingface and AWS Lambda, Quantum Computing with AWS Braket - Tutorial

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serverless-Question-Answering-API

Serverless BERT with Huggingface and AWS Lambda, Quantum Computing with AWS Braket - Tutorial

Problem Statement

image

Architecture

image

Deployed Elastic Container Registry image

image

Delployed AWS Lambda function with a custom docker image & serverless deploy

image

Test the deployed Q&A API

We test the API using AWS API gateway REST client. The first run of the API is the cold start and you will get server error because the model is getting loaded and initialized. But on subsequent API calls it wil run as expected.

Request Body -

{
  "context": "We introduce a new language representation model called BERT, which stands for idirectional Encoder Representations from Transformers. Unlike recent language epresentation models (Peters et al., 2018a; Radford et al., 2018), BERT is designed to pretrain deep bidirectional representations from unlabeled text by jointly conditioning on both left and right context in all layers. As a result, the pre-trained BERT model can be finetuned with just one additional output layer to create state-of-the-art models for a wide range of tasks, such as question answering and language inference, without substantial taskspecific architecture modifications. BERT is conceptually simple and empirically powerful. It obtains new state-of-the-art results on eleven natural language processing tasks, including pushing the GLUE score to 80.5% (7.7% point absolute improvement), MultiNLI accuracy to 86.7% (4.6% absolute improvement), SQuAD v1.1 question answering Test F1 to 93.2 (1.5 point absolute improvement) and SQuAD v2.0 Test F1 to 83.1 (5.1 point absolute improvement).",
  "question": "What is BERTs best score on Squadv2 ?"
}

image

References

https://www.youtube.com/watch?v=Q10vhymrGh4&ab_channel=DataScienceOnAWS

https://github.com/philschmid/serverless-bert-huggingface-aws-lambda-docker

https://towardsdatascience.com/serverless-bert-with-huggingface-and-aws-lambda-625193c6cc04

About

Serverless BERT with Huggingface and AWS Lambda, Quantum Computing with AWS Braket - Tutorial

License:MIT License


Languages

Language:Python 100.0%