Skip to content

Commit f2d3296

Browse files
AWS Serverless update (#1115)
* update deepsparse version * cleanup
1 parent c6aa08f commit f2d3296

File tree

6 files changed

+11
-203
lines changed

6 files changed

+11
-203
lines changed

examples/aws-serverless/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ python endpoint.py create-realtime
9090

9191
#### Call Realtime Endpoint
9292

93-
After the endpoint has been staged (~3 minute), AWS SAM will provide your API Gateway endpoint URL in CLI. You can start making requests by passing this URL into the LambdaClient object. Afterwards, you can run inference by passing in your text input:
93+
After the endpoint has been staged (~3 minutes), AWS SAM will provide your API Gateway endpoint URL in terminal. You can start making requests by passing this URL into the LambdaClient object. Afterwards, you can run inference by passing in your text input:
9494

9595
```python
9696
from client import LambdaClient
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
boto3>=1.18.34
2-
https://github.com/neuralmagic/transformers/releases/download/v1.4/transformers-4.23.1-py3-none-any.whl
3-
deepsparse>=1.4.0
2+
deepsparse[transformers]>=1.5.2

examples/aws-serverless/realtime/app/Dockerfile

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
1-
# Pull the base image with python 3.8 as a runtime for your Lambda
2-
FROM public.ecr.aws/lambda/python:3.8
1+
# Pull the base image with python 3.10 as a runtime for your Lambda
2+
FROM public.ecr.aws/lambda/python:3.10.2023.07.11.09
33

4-
ENV VIRTUAL_ENV=/venv
5-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
6-
7-
COPY topo-four-core.json ./
8-
ENV NM_ARCH_FILE=./topo-four-core.json
9-
10-
# Copy the earlier created requirements.txt file to the container
4+
# Copy the requirements.txt file to the container
115
COPY requirements.txt ./
126

137
# Install the python requirements from requirements.txt
14-
RUN python3 -m venv $VIRTUAL_ENV && \
15-
pip install --no-cache-dir --upgrade pip && \
16-
python3.8 -m pip install -r requirements.txt
8+
RUN pip install --no-cache-dir --upgrade pip && \
9+
pip install -r requirements.txt
1710

1811
# Copy the earlier created app.py file to the container
1912
COPY app.py ./
2013

21-
# Load the BERT model from SparseZoo and store it in the model directory
14+
# Load model from SparseZoo and store it in the model directory
2215
RUN mkdir model
2316

24-
# RUN sparsezoo.download zoo:nlp/question_answering/distilbert-none/pytorch/huggingface/squad/pruned80_quant-none-vnni --save-dir ./model
2517
RUN sparsezoo.download zoo:nlp/sentiment_analysis/obert-base/pytorch/huggingface/sst2/pruned90_quant-none --save-dir ./model
2618

2719
# Set the CMD to your handler
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
https://github.com/neuralmagic/transformers/releases/download/v1.4/transformers-4.23.1-py3-none-any.whl
2-
deepsparse>=1.2.0
1+
deepsparse[transformers]>=1.5.2

examples/aws-serverless/realtime/app/topo-four-core.json

-182
This file was deleted.

examples/aws-serverless/realtime/template.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Resources:
77
Type: AWS::Serverless::Function
88
Properties:
99
PackageType: Image
10-
ImageUri: deepsparseendpoint:python3.8-v1
10+
ImageUri: deepsparseendpoint:python3.10-v1
1111
MemorySize: 2000
1212
Timeout: 300
1313
Role: !GetAtt LambdaExecutionRole.Arn
@@ -21,7 +21,7 @@ Resources:
2121
Metadata:
2222
Dockerfile: Dockerfile
2323
DockerContext: ./app
24-
DockerTag: python3.8-v1
24+
DockerTag: python3.10-v1
2525

2626
LambdaExecutionRole:
2727
Type: AWS::IAM::Role

0 commit comments

Comments
 (0)