Skip to content

Commit 3518703

Browse files
committed
📌 Use cpu torch
1 parent 2b1224e commit 3518703

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ RUN apt-get update && apt-get install -y curl build-essential
66
ENV PYTHONUNBUFFERED 1
77
ENV PYTHONDONTWRITEBYTECODE 1
88
ADD requirements.txt /app/requirements.txt
9-
RUN pip install -r requirements.txt
9+
RUN export TORCH_VERSION=$(grep torch== requirements.txt | cut -d'=' -f3) && \
10+
pip install torch==$TORCH_VERSION --index-url https://download.pytorch.org/whl/cpu --no-cache-dir && \
11+
pip install -r requirements.txt --no-cache-dir
1012

1113
# ADDING FILES
1214
ADD app.py /app/app.py

pdm.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+13
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,16 @@ dev = [
3131

3232
[tool.pdm]
3333
distribution = false
34+
35+
[[tool.pdm.source]]
36+
url = "https://pypi.org/simple"
37+
verify_ssl = true
38+
name = "pypi"
39+
exclude_packages = ["torch", "torchvision", "torchaudio"]
40+
41+
[[tool.pdm.source]]
42+
name = "torch"
43+
url = "https://download.pytorch.org/whl/cpu"
44+
include_packages = ["torch", "torchvision", "torchaudio"]
45+
exclude_packages = ["*"]
46+

requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ shellingham==1.5.4
6060
sniffio==1.3.1
6161
starlette==0.37.2
6262
sympy==1.12.1
63-
tbb==2021.12.0; platform_system == "Windows"
63+
tbb==2021.13.0; platform_system == "Windows"
6464
tokenizers==0.19.1
6565
torch==2.3.1
6666
tqdm==4.66.4
@@ -75,3 +75,5 @@ uvloop==0.19.0; (sys_platform != "cygwin" and sys_platform != "win32") and platf
7575
watchdog==4.0.1
7676
watchfiles==0.22.0
7777
websockets==12.0
78+
--index-url https://pypi.org/simple
79+
--extra-index-url https://download.pytorch.org/whl/cpu

0 commit comments

Comments
 (0)