Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f95d374

Browse files
committedJul 1, 2024
docker example
1 parent 45628ea commit f95d374

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed
 

‎.github/workflows/build-container.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: ./.github/workflows/docker-build-action.yaml
3939
with:
4040
image: inference-pytorch-inf2
41-
dockerfile: dockerfiles/pytorch/Dockerfile
41+
dockerfile: dockerfiles/pytorch/Dockerfile.inf2
4242
secrets:
4343
TAILSCALE_AUTHKEY: ${{ secrets.TAILSCALE_AUTHKEY }}
4444
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}

‎README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ make inference-pytorch-inf2
180180
2. Run the container and provide either environment variables to the HUB model you want to use or mount a volume to the container, where your model is stored.
181181

182182
```bash
183-
docker run -ti -p 5000:5000 -e HF_MODEL_ID="distilbert/distilbert-base-uncased-finetuned-sst-2-english" -e HF_TASK="text-classification" -e HF_OPTIMUM_BATCH_SIZE=1 -e HF_OPTIMUM_SEQUENCE_LENGTH=128 integration-test-pytorch:inf2
183+
docker run -ti -p 5000:5000 -e HF_MODEL_ID="distilbert/distilbert-base-uncased-finetuned-sst-2-english" -e HF_TASK="text-classification" -e HF_OPTIMUM_BATCH_SIZE=1 -e HF_OPTIMUM_SEQUENCE_LENGTH=128 --device=/dev/neuron0 integration-test-pytorch:inf2
184184
```
185185

186186
3. Send request
@@ -190,7 +190,7 @@ curl --request POST \
190190
--url http://localhost:5000 \
191191
--header 'Content-Type: application/json' \
192192
--data '{
193-
"inputs": "Wow, this is such a great product. I love it!"
193+
"inputs": "Wow, this is such a great product. I love it!",
194194
"parameters": { "top_k": 2 }
195195
}'
196196
```

‎dockerfiles/pytorch/Dockerfile.inf2

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,18 @@ RUN conda install -c conda-forge \
9999
&& conda clean -ya \
100100
&& pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org \
101101
&& ln -s /opt/conda/bin/pip /usr/local/bin/pip3 \
102-
&& pip install packaging
103-
104-
# Install Neuronx-cc and PyTorch
105-
RUN pip install --extra-index-url https://pip.repos.neuron.amazonaws.com \
106-
neuronx-cc==$NEURONX_CC_VERSION \
107-
torch-neuronx==$NEURONX_FRAMEWORK_VERSION \
108-
neuronx_distributed==$NEURONX_DISTRIBUTED_VERSION \
109-
transformers-neuronx==$NEURONX_TRANSFORMERS_VERSION \
110-
&& pip install "protobuf>=3.18.3,<4" \
111-
&& pip install --no-deps --no-cache-dir -U torchvision==0.16.*
102+
&& pip install --no-cache-dir "protobuf>=3.18.3,<4" setuptools==69.5.1 packaging
112103

113104
WORKDIR /
114105

115106
# install Hugging Face libraries and its dependencies
116-
RUN pip install --no-cache-dir optimum-neuron[neuronx]==${OPTIMUM_NEURON_VERSION}
107+
RUN pip install --extra-index-url https://pip.repos.neuron.amazonaws.com --no-cache-dir optimum-neuron[neuronx]==${OPTIMUM_NEURON_VERSION} \
108+
&& pip install --no-deps --no-cache-dir -U torchvision==0.16.*
109+
117110

118111
COPY . .
119112
# install wheel and setuptools
120-
RUN pip install --no-cache-dir -U pip .
113+
RUN pip install --no-cache-dir -U pip "."
121114

122115
# copy application
123116
COPY src/huggingface_inference_toolkit huggingface_inference_toolkit

0 commit comments

Comments
 (0)
Please sign in to comment.