2023-05-13 03:58:15 +08:00
|
|
|
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
|
2022-02-24 04:48:19 +08:00
|
|
|
LABEL maintainer="Hugging Face"
|
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2022-06-17 22:42:27 +08:00
|
|
|
# Use login shell to read variables from `~/.profile` (to pass dynamic created variables between RUN commands)
|
|
|
|
SHELL ["sh", "-lc"]
|
|
|
|
|
2022-06-08 21:04:22 +08:00
|
|
|
# The following `ARG` are mainly used to specify the versions explicitly & directly in this docker file, and not meant
|
|
|
|
# to be used as arguments for docker build (so far).
|
|
|
|
|
2024-01-09 18:05:19 +08:00
|
|
|
ARG PYTORCH='2.1.1'
|
2022-06-08 21:04:22 +08:00
|
|
|
# (not always a valid torch version)
|
2024-01-11 22:34:05 +08:00
|
|
|
ARG INTEL_TORCH_EXT='2.1.100'
|
2022-06-08 21:04:22 +08:00
|
|
|
# Example: `cu102`, `cu113`, etc.
|
2023-05-13 03:58:15 +08:00
|
|
|
ARG CUDA='cu118'
|
2022-06-08 21:04:22 +08:00
|
|
|
|
2022-02-24 04:48:19 +08:00
|
|
|
RUN apt update
|
2022-06-08 17:45:10 +08:00
|
|
|
RUN apt install -y git libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg git-lfs
|
|
|
|
RUN git lfs install
|
2022-02-24 04:48:19 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir --upgrade pip
|
|
|
|
|
2022-03-25 21:12:23 +08:00
|
|
|
ARG REF=main
|
2022-02-24 04:48:19 +08:00
|
|
|
RUN git clone https://github.com/huggingface/transformers && cd transformers && git checkout $REF
|
|
|
|
|
2023-03-24 21:29:05 +08:00
|
|
|
# TODO: Handle these in a python utility script
|
|
|
|
RUN [ ${#PYTORCH} -gt 0 -a "$PYTORCH" != "pre" ] && VERSION='torch=='$PYTORCH'.*' || VERSION='torch'; echo "export VERSION='$VERSION'" >> ~/.profile
|
|
|
|
RUN echo torch=$VERSION
|
|
|
|
# `torchvision` and `torchaudio` should be installed along with `torch`, especially for nightly build.
|
|
|
|
# Currently, let's just use their latest releases (when `torch` is installed with a release version)
|
|
|
|
# TODO: We might need to specify proper versions that work with a specific torch version (especially for past CI).
|
|
|
|
RUN [ "$PYTORCH" != "pre" ] && python3 -m pip install --no-cache-dir -U $VERSION torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/$CUDA || python3 -m pip install --no-cache-dir -U --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/$CUDA
|
2022-06-17 22:42:27 +08:00
|
|
|
|
2023-08-07 18:32:34 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir -U tensorflow==2.13 protobuf==3.20.3 tensorflow_text tensorflow_probability
|
2023-08-01 02:13:15 +08:00
|
|
|
|
|
|
|
RUN python3 -m pip install --no-cache-dir -e ./transformers[dev,onnxruntime]
|
|
|
|
|
2022-02-24 04:48:19 +08:00
|
|
|
RUN python3 -m pip uninstall -y flax jax
|
2022-06-07 17:53:05 +08:00
|
|
|
|
2023-11-06 18:27:22 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir intel_extension_for_pytorch==$INTEL_TORCH_EXT -f https://developer.intel.com/ipex-whl-stable-cpu
|
2022-06-07 17:53:05 +08:00
|
|
|
|
2022-10-26 23:06:46 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir git+https://github.com/facebookresearch/detectron2.git pytesseract
|
2022-02-24 04:48:19 +08:00
|
|
|
RUN python3 -m pip install -U "itsdangerous<2.1.0"
|
|
|
|
|
2022-05-14 01:47:09 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/accelerate@main#egg=accelerate
|
|
|
|
|
2023-08-19 01:08:03 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/peft@main#egg=peft
|
|
|
|
|
2022-08-10 15:13:36 +08:00
|
|
|
# Add bitsandbytes for mixed int8 testing
|
2022-08-17 06:48:10 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir bitsandbytes
|
2022-08-10 15:13:36 +08:00
|
|
|
|
2023-08-11 04:06:29 +08:00
|
|
|
# Add auto-gptq for gtpq quantization testing
|
2023-08-24 20:57:16 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
|
2023-08-11 04:06:29 +08:00
|
|
|
|
2023-08-17 23:34:25 +08:00
|
|
|
# Add einops for additional model testing
|
|
|
|
RUN python3 -m pip install --no-cache-dir einops
|
|
|
|
|
2023-11-01 16:06:31 +08:00
|
|
|
# Add autoawq for quantization testing
|
2023-12-25 18:06:56 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.8/autoawq-0.1.8+cu118-cp38-cp38-linux_x86_64.whl
|
2023-11-01 16:06:31 +08:00
|
|
|
|
2024-01-10 20:39:05 +08:00
|
|
|
# For bettertransformer + gptq
|
2023-08-11 04:06:29 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/optimum@main#egg=optimum
|
2023-04-27 17:03:42 +08:00
|
|
|
|
2023-03-02 20:30:38 +08:00
|
|
|
# For video model testing
|
|
|
|
RUN python3 -m pip install --no-cache-dir decord av==9.2.0
|
2022-08-09 01:28:51 +08:00
|
|
|
|
2023-03-24 21:29:05 +08:00
|
|
|
# For `dinat` model
|
2024-01-11 22:34:05 +08:00
|
|
|
RUN python3 -m pip install --no-cache-dir 'natten<0.15.0' -f https://shi-labs.com/natten/wheels/$CUDA/
|
2022-12-05 22:08:32 +08:00
|
|
|
|
2023-11-13 23:38:13 +08:00
|
|
|
# For `nougat` tokenizer
|
|
|
|
RUN python3 -m pip install --no-cache-dir python-Levenshtein
|
|
|
|
|
2022-02-24 04:48:19 +08:00
|
|
|
# When installing in editable mode, `transformers` is not recognized as a package.
|
|
|
|
# this line must be added in order for python to be aware of transformers.
|
|
|
|
RUN cd transformers && python3 setup.py develop
|