chendl/compositional_test
1
1# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel_22-08.html#rel_22-082FROM nvcr.io/nvidia/pytorch:22.08-py33LABEL maintainer="Hugging Face"4 5ARG DEBIAN_FRONTEND=noninteractive6 7# Example: `cu102`, `cu113`, etc.8ARG CUDA='cu117'9 10RUN apt -y update11RUN apt install -y libaio-dev12RUN python3 -m pip install --no-cache-dir --upgrade pip13 14ARG REF=main15RUN git clone https://github.com/huggingface/transformers && cd transformers && git checkout $REF16 17# Install **nightly** release PyTorch (flag `--pre`)18# (PyTorch must be installed before pre-compiling any DeepSpeed c++/cuda ops.)19# (https://www.deepspeed.ai/tutorials/advanced-install/#pre-install-deepspeed-ops)20RUN python3 -m pip install --no-cache-dir -U --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/$CUDA21 22RUN python3 -m pip install --no-cache-dir ./transformers[deepspeed-testing]23 24# Uninstall `torch-tensorrt` and `apex` shipped with the base image25RUN python3 -m pip uninstall -y torch-tensorrt apex26 27# Pre-build **nightly** release of DeepSpeed, so it would be ready for testing (otherwise, the 1st deepspeed test will timeout)28RUN python3 -m pip uninstall -y deepspeed29# This has to be run inside the GPU VMs running the tests. (So far, it fails here due to GPU checks during compilation.)30# Issue: https://github.com/microsoft/DeepSpeed/issues/201031# RUN git clone https://github.com/microsoft/DeepSpeed && cd DeepSpeed && rm -rf build && \32# DS_BUILD_CPU_ADAM=1 DS_BUILD_FUSED_ADAM=1 DS_BUILD_AIO=1 DS_BUILD_UTILS=1 python3 -m pip install . --global-option="build_ext" --global-option="-j8" --no-cache -v --disable-pip-version-check 2>&133 34## For `torchdynamo` tests35## (see https://github.com/huggingface/transformers/pull/17765)36#RUN git clone https://github.com/pytorch/functorch37#RUN python3 -m pip install --no-cache-dir ./functorch[aot]38#RUN cd functorch && python3 setup.py develop39#40#RUN git clone https://github.com/pytorch/torchdynamo41#RUN python3 -m pip install -r ./torchdynamo/requirements.txt42#RUN cd torchdynamo && python3 setup.py develop43#44## install TensorRT45#RUN python3 -m pip install --no-cache-dir -U nvidia-pyindex46#RUN python3 -m pip install --no-cache-dir -U nvidia-tensorrt==8.2.4.247#48## install torch_tensorrt (fx path)49#RUN git clone https://github.com/pytorch/TensorRT.git50#RUN cd TensorRT/py && python3 setup.py install --fx-only51 52# When installing in editable mode, `transformers` is not recognized as a package.53# this line must be added in order for python to be aware of transformers.54RUN cd transformers && python3 setup.py develop55 56# Disable for now as deepspeed is not installed above. To be enabled once the issue is fixed.57# RUN python3 -c "from deepspeed.launcher.runner import main"58 