Skip to content

Commit 13e9b74

Browse files
authored
Create docker images which can be run on GPU (#20)
* use parent image for gpu build, trigger drone gpu build on every push * fix torchvision version number to avoid dependency conflict * use dockerhub parent image, add gpu pipeline * use dash in tags instead of underscore * updates pillow because of dependabot warning * updates submodule model
1 parent 75dfa84 commit 13e9b74

File tree

7 files changed

+423
-17
lines changed

7 files changed

+423
-17
lines changed

.drone.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,13 @@ steps:
122122
from_secret: docker_password
123123
dockerfile: gpu.Dockerfile
124124
repo: "registry.dev.onetask.ai/${DRONE_REPO}"
125-
tags: ["${DRONE_COMMIT_SHA}_gpu", "${DRONE_COMMIT_BRANCH}_gpu"]
125+
tags: ["${DRONE_COMMIT_SHA}-gpu", "${DRONE_COMMIT_BRANCH}-gpu"]
126126
cache_from:
127-
- "registry.dev.onetask.ai/${DRONE_REPO}:gpu"
128-
- "registry.dev.onetask.ai/${DRONE_REPO}:${DRONE_COMMIT_BRANCH}_gpu"
127+
- "registry.dev.onetask.ai/${DRONE_REPO}:${DRONE_COMMIT_BRANCH}-gpu"
129128

130129
trigger:
131130
branch:
132131
- dev
133-
- beta-v2
134132
event:
135133
- push
136134

@@ -163,6 +161,36 @@ trigger:
163161
event:
164162
- tag
165163

164+
---
165+
kind: pipeline
166+
type: docker
167+
name: amd64-gpu-dockerhub
168+
169+
platform:
170+
arch: amd64
171+
172+
steps:
173+
- name: submodules
174+
image: alpine/git
175+
commands:
176+
- git submodule init
177+
- 'git config --global url."https://github.com/".insteadOf [email protected]:'
178+
- "git submodule update --recursive --remote"
179+
- name: build and publish
180+
image: plugins/docker
181+
settings:
182+
username:
183+
from_secret: dockerhub_username
184+
password:
185+
from_secret: dockerhub_password
186+
dockerfile: gpu.Dockerfile
187+
repo: "kernai/${DRONE_REPO_NAME}"
188+
tag: "${DRONE_TAG}-gpu"
189+
190+
trigger:
191+
event:
192+
- tag
193+
166194
---
167195
kind: pipeline
168196
type: docker

gpu-requirements.txt

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
#
2+
# This file is autogenerated by pip-compile with python 3.9
3+
# To update, run:
4+
#
5+
# pip-compile --output-file=gpu-requirements.txt requirements/gpu-requirements.in
6+
#
7+
--extra-index-url https://download.pytorch.org/whl/cu113
8+
9+
anyio==3.6.2
10+
# via
11+
# -r requirements/torch-cuda-requirements.txt
12+
# starlette
13+
blis==0.7.9
14+
# via thinc
15+
boto3==1.25.0
16+
# via -r requirements/torch-cuda-requirements.txt
17+
botocore==1.28.5
18+
# via
19+
# -r requirements/torch-cuda-requirements.txt
20+
# boto3
21+
# s3transfer
22+
catalogue==2.0.8
23+
# via
24+
# spacy
25+
# srsly
26+
# thinc
27+
certifi==2022.9.24
28+
# via
29+
# -r requirements/torch-cuda-requirements.txt
30+
# minio
31+
# requests
32+
charset-normalizer==2.1.1
33+
# via
34+
# -r requirements/torch-cuda-requirements.txt
35+
# requests
36+
click==8.1.3
37+
# via
38+
# -r requirements/torch-cuda-requirements.txt
39+
# nltk
40+
# typer
41+
# uvicorn
42+
confection==0.0.3
43+
# via thinc
44+
cymem==2.0.7
45+
# via
46+
# preshed
47+
# spacy
48+
# thinc
49+
embedders==0.0.18
50+
# via -r requirements/gpu-requirements.in
51+
fastapi==0.85.1
52+
# via -r requirements/torch-cuda-requirements.txt
53+
filelock==3.8.0
54+
# via
55+
# -r requirements/torch-cuda-requirements.txt
56+
# huggingface-hub
57+
# transformers
58+
h11==0.14.0
59+
# via
60+
# -r requirements/torch-cuda-requirements.txt
61+
# uvicorn
62+
huggingface-hub==0.10.1
63+
# via
64+
# -r requirements/torch-cuda-requirements.txt
65+
# sentence-transformers
66+
# transformers
67+
idna==3.4
68+
# via
69+
# -r requirements/torch-cuda-requirements.txt
70+
# anyio
71+
# requests
72+
jinja2==3.1.2
73+
# via spacy
74+
jmespath==1.0.1
75+
# via
76+
# -r requirements/torch-cuda-requirements.txt
77+
# boto3
78+
# botocore
79+
joblib==1.2.0
80+
# via
81+
# nltk
82+
# scikit-learn
83+
langcodes==3.3.0
84+
# via spacy
85+
markupsafe==2.1.1
86+
# via jinja2
87+
minio==7.1.12
88+
# via -r requirements/torch-cuda-requirements.txt
89+
murmurhash==1.0.9
90+
# via
91+
# preshed
92+
# spacy
93+
# thinc
94+
nltk==3.7
95+
# via sentence-transformers
96+
numpy==1.23.4
97+
# via
98+
# -r requirements/torch-cuda-requirements.txt
99+
# blis
100+
# embedders
101+
# pandas
102+
# scikit-learn
103+
# scipy
104+
# sentence-transformers
105+
# spacy
106+
# thinc
107+
# torchvision
108+
# transformers
109+
packaging==21.3
110+
# via
111+
# -r requirements/torch-cuda-requirements.txt
112+
# huggingface-hub
113+
# spacy
114+
# transformers
115+
pandas==1.5.1
116+
# via -r requirements/torch-cuda-requirements.txt
117+
pathy==0.6.2
118+
# via spacy
119+
pillow==9.3.0
120+
# via torchvision
121+
preshed==3.0.8
122+
# via
123+
# spacy
124+
# thinc
125+
psycopg2-binary==2.9.4
126+
# via -r requirements/torch-cuda-requirements.txt
127+
pydantic==1.10.2
128+
# via
129+
# -r requirements/torch-cuda-requirements.txt
130+
# confection
131+
# fastapi
132+
# spacy
133+
# thinc
134+
pyparsing==3.0.9
135+
# via
136+
# -r requirements/torch-cuda-requirements.txt
137+
# packaging
138+
python-dateutil==2.8.2
139+
# via
140+
# -r requirements/torch-cuda-requirements.txt
141+
# botocore
142+
# pandas
143+
pytz==2022.6
144+
# via
145+
# -r requirements/torch-cuda-requirements.txt
146+
# pandas
147+
pyyaml==6.0
148+
# via
149+
# -r requirements/torch-cuda-requirements.txt
150+
# huggingface-hub
151+
# transformers
152+
regex==2022.10.31
153+
# via
154+
# -r requirements/torch-cuda-requirements.txt
155+
# nltk
156+
# transformers
157+
requests==2.28.1
158+
# via
159+
# -r requirements/torch-cuda-requirements.txt
160+
# huggingface-hub
161+
# spacy
162+
# torchvision
163+
# transformers
164+
s3transfer==0.6.0
165+
# via
166+
# -r requirements/torch-cuda-requirements.txt
167+
# boto3
168+
scikit-learn==1.1.3
169+
# via
170+
# embedders
171+
# sentence-transformers
172+
scipy==1.9.3
173+
# via
174+
# scikit-learn
175+
# sentence-transformers
176+
sentence-transformers==2.2.2
177+
# via embedders
178+
sentencepiece==0.1.97
179+
# via sentence-transformers
180+
six==1.16.0
181+
# via
182+
# -r requirements/torch-cuda-requirements.txt
183+
# python-dateutil
184+
smart-open==5.2.1
185+
# via pathy
186+
sniffio==1.3.0
187+
# via
188+
# -r requirements/torch-cuda-requirements.txt
189+
# anyio
190+
spacy==3.4.2
191+
# via
192+
# -r requirements/gpu-requirements.in
193+
# embedders
194+
spacy-legacy==3.0.10
195+
# via spacy
196+
spacy-loggers==1.0.3
197+
# via spacy
198+
sqlalchemy==1.4.42
199+
# via -r requirements/torch-cuda-requirements.txt
200+
srsly==2.4.5
201+
# via
202+
# confection
203+
# spacy
204+
# thinc
205+
starlette==0.20.4
206+
# via
207+
# -r requirements/torch-cuda-requirements.txt
208+
# fastapi
209+
thinc==8.1.5
210+
# via spacy
211+
threadpoolctl==3.1.0
212+
# via scikit-learn
213+
tokenizers==0.13.2
214+
# via
215+
# -r requirements/torch-cuda-requirements.txt
216+
# transformers
217+
torch==1.12.1
218+
# via
219+
# -r requirements/torch-cuda-requirements.txt
220+
# embedders
221+
# sentence-transformers
222+
# torchvision
223+
torchvision==0.13.1
224+
# via
225+
# -r requirements/gpu-requirements.in
226+
# sentence-transformers
227+
tqdm==4.64.1
228+
# via
229+
# -r requirements/torch-cuda-requirements.txt
230+
# embedders
231+
# huggingface-hub
232+
# nltk
233+
# sentence-transformers
234+
# spacy
235+
# transformers
236+
transformers==4.23.1
237+
# via
238+
# -r requirements/torch-cuda-requirements.txt
239+
# embedders
240+
# sentence-transformers
241+
typer==0.4.2
242+
# via
243+
# pathy
244+
# spacy
245+
typing-extensions==4.4.0
246+
# via
247+
# -r requirements/torch-cuda-requirements.txt
248+
# huggingface-hub
249+
# pydantic
250+
# starlette
251+
# torch
252+
# torchvision
253+
urllib3==1.26.12
254+
# via
255+
# -r requirements/torch-cuda-requirements.txt
256+
# botocore
257+
# minio
258+
# requests
259+
uvicorn==0.19.0
260+
# via -r requirements/torch-cuda-requirements.txt
261+
wasabi==0.10.1
262+
# via
263+
# spacy
264+
# spacy-loggers
265+
# thinc
266+
267+
# The following packages are considered to be unsafe in a requirements file:
268+
# setuptools

gpu.Dockerfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
FROM nvidia/cuda:11.4.0-base-ubuntu20.04
2-
CMD nvidia-smi
3-
4-
#set up environment
5-
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y curl
6-
RUN apt-get install unzip
7-
RUN apt-get -y install python3.9
8-
RUN apt-get -y install python3-pip
1+
FROM kernai/refinery-parent-images:v1.6.0-torch-cuda
92

103
WORKDIR /program
114

12-
COPY requirements.txt .
5+
COPY gpu-requirements.txt .
136

14-
RUN python3.9 -m pip install -r requirements.txt
7+
RUN python3.9 -m pip install --no-cache-dir -r gpu-requirements.txt
158

169
COPY / .
1710

18-
CMD [ "/usr/local/bin/uvicorn", "--host", "0.0.0.0", "--port", "80", "app:app" ]
11+
CMD [ "/usr/local/bin/uvicorn", "--host", "0.0.0.0", "--port", "80", "app:app" ]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pandas==1.5.1
116116
# via -r requirements/torch-cpu-requirements.txt
117117
pathy==0.6.2
118118
# via spacy
119-
pillow==9.2.0
119+
pillow==9.3.0
120120
# via torchvision
121121
preshed==3.0.8
122122
# via

requirements/gpu-requirements.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r torch-cuda-requirements.txt
2+
embedders==0.0.18
3+
spacy==3.4.2
4+
torchvision==0.13.1 # define version for torchvision to avoid dependency conflict

0 commit comments

Comments
 (0)