Skip to content

Commit 1d86268

Browse files
committed
add PyTorch 1.6 for backend.ai
1 parent 4eb2e4a commit 1d86268

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
FROM lablup/common-base:20.07-py36-cuda10.1
2+
3+
# Install TensorFlow, Keras, PyTorch and MXNet
4+
ENV PYTORCH_VERSION=1.6.0
5+
ENV TORCHVISION_VERSION=0.6.0
6+
ENV TORCHAUDIO_VERSION=0.5.0
7+
ENV TORCHTEXT_VERSION=0.6.0
8+
ENV TENSORBOARDX_VERSION=1.9
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
ENV mecab_dicdir /usr/local/lib/mecab/dic/mecab-ko-dic
11+
12+
ENV PYTHONUNBUFFERED=1 \
13+
LD_LIBRARY_PATH="/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:/usr/local/nvidia/lib64:/usr/include/x86_64-linux-gnu" \
14+
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin/mecab" \
15+
LANG=C.UTF-8
16+
17+
# Set default shell to /bin/bash
18+
SHELL ["/bin/bash", "-cu"]
19+
20+
RUN python3 -m pip install --no-cache-dir --upgrade \
21+
https://download.pytorch.org/whl/cu101/torch-${PYTORCH_VERSION}%2Bcu101-cp36-cp36m-linux_x86_64.whl \
22+
https://download.pytorch.org/whl/cu101/torchvision-${TORCHVISION_VERSION}%2Bcu101-cp36-cp36m-linux_x86_64.whl \
23+
https://download.pytorch.org/whl/torchaudio-${TORCHAUDIO_VERSION}-cp36-cp36m-linux_x86_64.whl \
24+
torchtext==${TORCHTEXT_VERSION} && \
25+
python3 -m pip install --no-cache-dir tensorboardX==${TENSORBOARDX_VERSION}
26+
27+
RUN python3 -m pip install --no-cache-dir \
28+
transformers \
29+
jupyter-tensorboard==0.2.0 \
30+
tensorwatch==0.8.10 \
31+
jupyterlab-nvdashboard==0.2.0
32+
33+
RUN python3 -m pip install --no-cache-dir --extra-index-url \
34+
https://developer.download.nvidia.com/compute/redist \
35+
nvidia-dali-cuda100
36+
37+
# torch2trt PyTorch to TensorRT converter which utilizes the TensorRT Python API
38+
WORKDIR /tmp
39+
RUN git clone https://github.com/NVIDIA-AI-IOT/torch2trt /tmp/torch2trt && \
40+
cd /tmp/torch2trt && \
41+
python3 setup.py install --plugins && \
42+
rm -fr /tmp/torch2trt
43+
44+
# Install Horovod, temporarily using CUDA stubs
45+
RUN ldconfig /usr/local/cuda/targets/x86_64-linux/lib/stubs && \
46+
HOROVOD_GPU_ALLREDUCE=NCCL HOROVOD_GPU_BROADCAST=NCCL \
47+
HOROVOD_WITH_TENSORFLOW=1 HOROVOD_WITH_PYTORCH=1 HOROVOD_WITHOUT_MXNET=1 \
48+
pip install --no-cache-dir horovod==0.19.4 && \
49+
ldconfig
50+
51+
RUN python3 -m pip install --no-cache-dir \
52+
mpi4py==3.0.3 \
53+
nni==1.6 \
54+
scikit-nni==0.2.1
55+
56+
# Install ipython kernelspec
57+
Run python3 -m ipykernel install --display-name "PyTorch 1.5.1 on Python 3.6 (CUDA 10.1)" && \
58+
cat /usr/local/share/jupyter/kernels/python3/kernel.json
59+
60+
# Backend.AI specifics
61+
LABEL ai.backend.kernelspec="1" \
62+
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
63+
ai.backend.features="batch query uid-match user-input" \
64+
ai.backend.base-distro="ubuntu16.04" \
65+
ai.backend.resource.min.cpu="1" \
66+
ai.backend.resource.min.mem="1g" \
67+
ai.backend.resource.min.cuda.device=0 \
68+
ai.backend.resource.min.cuda.shares=0 \
69+
ai.backend.runtime-type="python" \
70+
ai.backend.runtime-path="/usr/bin/python3" \
71+
ai.backend.service-ports="ipython:pty:3000,jupyter:http:8080,jupyterlab:http:8090,vscode:http:8180,tensorboard:http:6006"
72+
73+
WORKDIR /home/work
74+
# vim: ft=dockerfile

0 commit comments

Comments
 (0)