Skip to content

Commit 8697723

Browse files
author
Ubuntu
committed
uv & venv
1 parent 12af852 commit 8697723

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

dockerfiles/pytorch/gpu/Dockerfile

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LABEL maintainer="Hugging Face"
55

66
ENV DEBIAN_FRONTEND=noninteractive
77

8-
WORKDIR /build
8+
WORKDIR /app
99

1010
RUN apt-get update \
1111
&& apt-get -y upgrade --only-upgrade systemd openssl cryptsetup \
@@ -35,32 +35,34 @@ COPY dockerfiles/pytorch/gpu/requirements.txt requirements-docker.txt
3535
COPY requirements.txt requirements-toolkit.txt
3636

3737
# install wheel and setuptools
38-
RUN pip install -U pip && \
39-
pip download --dest ./wheels -r requirements-docker.txt && \
40-
pip download --dest ./wheels -r requirements-toolkit.txt && \
41-
pip install --no-index --find-links=./wheels -r requirements-docker.txt && \
42-
pip install --no-index --find-links=./wheels -r requirements-toolkit.txt
38+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
39+
source $HOME/.cargo/env && \
40+
uv venv && \
41+
source .venv/bin/activate && \
42+
uv pip install --no-cache-dir -r requirements-docker.txt && \
43+
uv pip install --no-cache-dir -r requirements-toolkit.txt
4344

4445
### Runner
4546

4647
FROM nvidia/cuda:12.3.1-base-ubuntu22.04 as runner
4748
SHELL ["/bin/bash", "-c"]
4849

4950
WORKDIR /app
50-
COPY --from=builder /build/wheels /app/wheels
5151

5252
RUN apt-get update -y && apt-get upgrade -y && \
5353
apt-get install -y \
5454
python3 \
55-
python3-pip
55+
python3-pip \
56+
python3.10-venv \
57+
curl
5658

5759
# install dependencies
58-
COPY dockerfiles/pytorch/gpu/requirements.txt requirements-docker.txt
59-
COPY requirements.txt requirements-toolkit.txt
60+
COPY --from=builder /app .
6061

61-
RUN pip install -U pip && \
62-
pip install --no-index --find-links=/app/wheels -r requirements-docker.txt && \
63-
pip install --no-index --find-links=/app/wheels -r requirements-toolkit.txt
62+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
63+
source $HOME/.cargo/env && \
64+
source .venv/bin/activate && \
65+
ls -all
6466

6567
# copy application
6668
COPY src/huggingface_inference_toolkit huggingface_inference_toolkit
@@ -70,4 +72,4 @@ COPY src/huggingface_inference_toolkit/webservice_starlette.py webservice_starle
7072
COPY scripts/entrypoint.sh entrypoint.sh
7173
RUN chmod +x entrypoint.sh
7274

73-
ENTRYPOINT ["bash", "-c", "./entrypoint.sh"]
75+
ENTRYPOINT ["bash", "-c", "source .venv/bin/activate && ./entrypoint.sh"]

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# We don't declare our dependency on transformers here because we build with
77
# different packages for different variants
88

9-
VERSION = "0.1.0"
9+
VERSION = "0.2.0"
1010

1111

1212
# Ubuntu packages
@@ -16,7 +16,7 @@
1616

1717
install_requires = [
1818
# transformers
19-
"transformers[sklearn,sentencepiece]>=4.25.1",
19+
"transformers[sklearn,sentencepiece]>=4.37.2",
2020
"huggingface_hub>=0.13.3",
2121
# api stuff
2222
"orjson",

0 commit comments

Comments
 (0)