How can I create lambda function code after deploying bart transformer for summarization in sagemaker?

Hey,
I’ll post about it later on Social Media (Twitter, LinkedIn) but here is the example: cdk-samples/aws-lambda-sagemaker-endpoint-huggingface at master · philschmid/cdk-samples · GitHub
It is an example using the CDK so if you want to deploy a BART model for summarization you can follow the readme.

clone the repository

git clone https://github.com/philschmid/cdk-samples.git
cd aws-lambda-sagemaker-endpoint-huggingface

Install the cdk required dependencies. Make your you have the cdk installed.

pip3 install -r requirements.txt

Bootstrap your application in the cloud.

cdk bootstrap

Deploy your Hugging Face Transformer model to Amazon SageMaker


cdk deploy \
-c model="facebook/bart-large-cnn" \
-c task="summarization"

clean up

cdk destroy \
-c model="facebook/bart-large-cnn" \
-c task="summarization"

If you only want to know/see the lambda code you can look here cdk-samples/handler.py at master · philschmid/cdk-samples · GitHub