Skip to content

Commit 0b91c65

Browse files
committed
updated versions
1 parent 9390c55 commit 0b91c65

File tree

9 files changed

+45
-192
lines changed

9 files changed

+45
-192
lines changed

README.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ mkdir tmp2/
7171
AIP_MODE=PREDICTION AIP_PORT=8080 AIP_PREDICT_ROUTE=/pred AIP_HEALTH_ROUTE=/h HF_MODEL_DIR=tmp2 HF_MODEL_ID=distilbert/distilbert-base-uncased-finetuned-sst-2-english HF_TASK=text-classification uvicorn src.huggingface_inference_toolkit.webservice_starlette:app --port 8080
7272
```
7373

74-
Send request. The API schema is the same as from the [inference API](https://huggingface.co/docs/api-inference/detailed_parameters)
74+
Send request
7575

7676
```bash
7777
curl --request POST \
@@ -83,6 +83,31 @@ curl --request POST \
8383
}'
8484
```
8585

86+
#### Container run with HF_MODEL_ID and HF_TASK
87+
88+
1. build the preferred container for either CPU or GPU for PyTorch o.
89+
90+
```bash
91+
docker build -t vertex -f dockerfiles/pytorch/Dockerfile -t vertex-test-pytorch:gpu .
92+
```
93+
94+
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.
95+
96+
```bash
97+
docker run -ti -p 8080:8080 -e AIP_MODE=PREDICTION -e AIP_HTTP_PORT=8080 -e AIP_PREDICT_ROUTE=/pred -e AIP_HEALTH_ROUTE=/h -e HF_MODEL_ID=distilbert/distilbert-base-uncased-finetuned-sst-2-english -e HF_TASK=text-classification vertex-test-pytorch:gpu
98+
```
99+
100+
1. Send request
101+
102+
```bash
103+
curl --request POST \
104+
--url http://localhost:8080/pred \
105+
--header 'Content-Type: application/json' \
106+
--data '{
107+
"instances": ["I love this product", "I hate this product"],
108+
"parameters": { "top_k": 2 }
109+
}'
110+
```
86111

87112

88113
---

dockerfiles/inference-endpoints/Dockerfile

-48
This file was deleted.

dockerfiles/pytorch/Dockerfile

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG BASE_IMAGE=nvidia/cuda:12.1.0-devel-ubuntu22.04
22

3-
FROM $BASE_IMAGE
3+
FROM $BASE_IMAGE as base
44
SHELL ["/bin/bash", "-c"]
55

66
LABEL maintainer="Hugging Face"
@@ -45,4 +45,10 @@ COPY src/huggingface_inference_toolkit/webservice_starlette.py webservice_starle
4545
# copy entrypoint and change permissions
4646
COPY --chmod=0755 scripts/entrypoint.sh entrypoint.sh
4747

48-
ENTRYPOINT ["bash", "-c", "./entrypoint.sh"]
48+
ENTRYPOINT ["bash", "-c", "./entrypoint.sh"]
49+
50+
51+
from base as vertex
52+
53+
# Install Vertex AI requiremented packages
54+
RUN pip install --no-cache-dir google-cloud-storage

dockerfiles/tensorflow/cpu/Dockerfile

-53
This file was deleted.

dockerfiles/tensorflow/cpu/environment.yaml

-8
This file was deleted.

dockerfiles/tensorflow/gpu/Dockerfile

-59
This file was deleted.

dockerfiles/tensorflow/gpu/environment.yaml

-9
This file was deleted.

makefile

+6
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,11 @@ inference-pytorch-gpu:
2626
inference-pytorch-cpu:
2727
docker build --build-arg="BASE_IMAGE=ubuntu:22.04" -f dockerfiles/pytorch/Dockerfile -t integration-test-pytorch:cpu .
2828

29+
vertex-pytorch-gpu:
30+
docker build -t vertex -f dockerfiles/pytorch/Dockerfile -t integration-test-pytorch:gpu .
31+
32+
vertex-pytorch-cpu:
33+
docker build -t vertex --build-arg="BASE_IMAGE=ubuntu:22.04" -f dockerfiles/pytorch/Dockerfile -t integration-test-pytorch:cpu .
34+
2935
stop-all:
3036
docker stop $$(docker ps -a -q) && docker container prune --force

setup.py

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
from __future__ import absolute_import
2-
from datetime import date
32
from setuptools import find_packages, setup
43

54
# We don't declare our dependency on transformers here because we build with
65
# different packages for different variants
76

87
VERSION = "0.3.0"
98

10-
119
# Ubuntu packages
1210
# libsndfile1-dev: torchaudio requires the development version of the libsndfile package which can be installed via a system package manager. On Ubuntu it can be installed as follows: apt install libsndfile1-dev
1311
# ffmpeg: ffmpeg is required for audio processing. On Ubuntu it can be installed as follows: apt install ffmpeg
1412
# libavcodec-extra : libavcodec-extra inculdes additional codecs for ffmpeg
1513

1614
install_requires = [
17-
"wheel==0.42.0",
18-
"setuptools==69.1.0",
19-
"cmake==3.28.3",
20-
"transformers[sklearn,sentencepiece, audio, vision]==4.38.2",
21-
"huggingface_hub==0.20.3",
15+
"transformers[sklearn,sentencepiece, audio,vision]==4.41.1",
2216
"orjson",
2317
# vision
2418
"Pillow",
@@ -31,15 +25,14 @@
3125
"starlette",
3226
"uvicorn",
3327
"pandas",
34-
"peft==0.9.0"
28+
"peft==0.11.1"
3529
]
3630

3731
extras = {}
3832

39-
extras["st"] = ["sentence_transformers==2.4.0"]
40-
extras["diffusers"] = ["diffusers==0.26.3", "accelerate==0.27.2"]
41-
extras["torch"] = ["torch==2.2.0", "torchvision", "torchaudio"]
42-
extras["tensorflow"] = ["tensorflow"]
33+
extras["st"] = ["sentence_transformers==2.7.0"]
34+
extras["diffusers"] = ["diffusers==0.28.0", "accelerate==0.30.1"]
35+
extras["torch"] = ["torch==2.3.0", "torchvision", "torchaudio"]
4336
extras["test"] = [
4437
"pytest==7.2.1",
4538
"pytest-xdist",

0 commit comments

Comments
 (0)