|
| 1 | +FROM lablup/common-base:py38-cuda11.1 |
| 2 | + |
| 3 | +# Install PyTorch |
| 4 | +ENV PYTORCH_VERSION=1.9.0 |
| 5 | +ENV TORCHVISION_VERSION=0.10.0 |
| 6 | +ENV TORCHAUDIO_VERSION=0.9.0 |
| 7 | +ENV TORCHTEXT_VERSION=0.10.0 |
| 8 | +ENV TENSORBOARDX_VERSION=2.1 |
| 9 | + |
| 10 | +RUN python3 -m pip uninstall -y torch && \ |
| 11 | + python3 -m pip install --no-cache-dir \ |
| 12 | + https://download.pytorch.org/whl/cu111/torch-${PYTORCH_VERSION}%2Bcu111-cp38-cp38-linux_x86_64.whl \ |
| 13 | + https://download.pytorch.org/whl/cu111/torchvision-${TORCHVISION_VERSION}%2Bcu111-cp38-cp38-linux_x86_64.whl \ |
| 14 | + https://download.pytorch.org/whl/torchaudio-${TORCHAUDIO_VERSION}-cp38-cp38-linux_x86_64.whl \ |
| 15 | + https://download.pytorch.org/whl/cu111/torchcsprng-0.2.1%2Bcu111-cp38-cp38-linux_x86_64.whl \ |
| 16 | + https://download.pytorch.org/whl/torchserve-0.4.0-py2.py3-none-any.whl \ |
| 17 | + https://download.pytorch.org/whl/torchtext-${TORCHTEXT_VERSION}-cp38-cp38-linux_x86_64.whl \ |
| 18 | + jsonargparse \ |
| 19 | + torchmetrics \ |
| 20 | + pyDeprecate \ |
| 21 | + fsspec[http]>=2021.05.0 \ |
| 22 | + PyYAML>=5.1 \ |
| 23 | + pretrainedmodels \ |
| 24 | + cnn-finetune \ |
| 25 | + pytorch-lightning && \ |
| 26 | + python3 -m pip install --no-cache-dir tensorboardX==${TENSORBOARDX_VERSION} |
| 27 | + |
| 28 | +# torch2trt PyTorch to TensorRT converter which utilizes the TensorRT Python API |
| 29 | +WORKDIR /tmp |
| 30 | +RUN git clone https://github.com/NVIDIA-AI-IOT/torch2trt /tmp/torch2trt && \ |
| 31 | + cd /tmp/torch2trt && \ |
| 32 | + python3 setup.py install --plugins && \ |
| 33 | + rm -fr /tmp/torch2trt |
| 34 | + |
| 35 | +RUN python3 -m pip install --extra-index-url \ |
| 36 | + https://developer.download.nvidia.com/compute/redist nvidia-dali-cuda100 |
| 37 | + |
| 38 | +# Install Horovod, temporarily using CUDA stubs |
| 39 | +RUN ldconfig /usr/local/cuda/targets/x86_64-linux/lib/stubs && \ |
| 40 | + HOROVOD_GPU_ALLREDUCE=NCCL HOROVOD_GPU_BROADCAST=NCCL \ |
| 41 | + HOROVOD_WITHOUT_TENSORFLOW=1 HOROVOD_WITH_PYTORCH=1 HOROVOD_WITHOUT_MXNET=1 \ |
| 42 | + pip install --no-cache-dir horovod==0.22.1 && \ |
| 43 | + ldconfig |
| 44 | + |
| 45 | +RUN python3 -m pip install --no-cache-dir \ |
| 46 | + mpi4py==3.0.3 \ |
| 47 | + mlflow==1.18.0 \ |
| 48 | + nni==2.3 \ |
| 49 | + tensorboard-plugin-wit \ |
| 50 | + scikit-nni==0.2.1 |
| 51 | + |
| 52 | +RUN apt autoclean && \ |
| 53 | + rm -rf /var/lib/apt/lists/* && \ |
| 54 | + rm -rf /root/.cache && \ |
| 55 | + rm -rf /tmp/* |
| 56 | + |
| 57 | +COPY ./service-defs /etc/backend.ai/service-defs |
| 58 | +COPY ./runner-scripts/bootstrap.sh runner-scripts/setup_multinode.py /opt/container/ |
| 59 | + |
| 60 | +# Install ipython kernelspec |
| 61 | +Run python3 -m ipykernel install --display-name "PyTorch 1.9.0 on Python 3.8 (CUDA 11.1)" && \ |
| 62 | + cat /usr/local/share/jupyter/kernels/python3/kernel.json |
| 63 | + |
| 64 | +# Backend.AI specifics |
| 65 | +LABEL ai.backend.kernelspec="1" \ |
| 66 | + ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \ |
| 67 | + ai.backend.features="batch query uid-match user-input" \ |
| 68 | + ai.backend.base-distro="ubuntu16.04" \ |
| 69 | + ai.backend.resource.min.cpu="1" \ |
| 70 | + ai.backend.resource.min.mem="1g" \ |
| 71 | + ai.backend.resource.min.cuda.device=0 \ |
| 72 | + ai.backend.resource.min.cuda.shares=0 \ |
| 73 | + ai.backend.runtime-type="python" \ |
| 74 | + ai.backend.runtime-path="/usr/bin/python3" \ |
| 75 | + ai.backend.service-ports="ipython:pty:3000,jupyter:http:8081,jupyterlab:http:8090,vscode:http:8180,tensorboard:http:6006,mlflow-ui:preopen:5000,nniboard:preopen:8080" |
| 76 | + |
| 77 | +WORKDIR /home/work |
| 78 | +# vim: ft=dockerfile |
0 commit comments