notebooks/components/example-notebook-servers/jupyter-pytorch-cuda/Dockerfile

36 lines
1.5 KiB
Docker

#
# NOTE: Use the Makefiles to build this image correctly.
#
ARG BASE_IMG=<jupyter>
FROM $BASE_IMG
# args - software versions
# https://github.com/pytorch/pytorch/releases
# https://github.com/pytorch/audio/releases
# https://github.com/pytorch/vision/releases
# NOTE: correct version alignments are found at https://pytorch.org/get-started/previous-versions/
# they sometimes forget to publish a github release of `torchaudio` or `torchvision` when the cut a
# patch release of `torch`, but they still publish a patch of `torchaudio` and `torchvision` on pypi
# TODO: it seems like torch 2.6.0+ with CUDA 12.6+ will have experimental aarch64 support
# when updating past that version, remember to test building these images on arm
ARG PYTORCH_VERSION=2.5.1
ARG TORCHAUDIO_VERSION=2.5.1
ARG TORCHVISION_VERSION=0.20.1
# nvidia container toolkit
# https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/docker-specialized.html
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
ENV NVIDIA_REQUIRE_CUDA "cuda>=12.4"
# install - pytorch (cuda)
RUN python3 -m pip install --quiet --no-cache-dir --index-url https://download.pytorch.org/whl/cu124 \
torch==${PYTORCH_VERSION} \
torchaudio==${TORCHAUDIO_VERSION} \
torchvision==${TORCHVISION_VERSION}
# install - requirements.txt
COPY --chown=${NB_USER}:${NB_GID} requirements.txt /tmp
RUN python3 -m pip install -r /tmp/requirements.txt --quiet --no-cache-dir \
&& rm -f /tmp/requirements.txt