Some checks failed
Self-hosted runner (nightly-past-ci-caller) / Get number (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.11 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.10 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.9 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.8 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.7 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.6 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.5 (push) Has been cancelled
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Has been cancelled
Build documentation / build (push) Has been cancelled
Build documentation / build_other_lang (push) Has been cancelled
CodeQL Security Analysis / CodeQL Analysis (push) Has been cancelled
New model PR merged notification / Notify new model (push) Has been cancelled
PR CI / pr-ci (push) Has been cancelled
Slow tests on important models (on Push - A10) / Get all modified files (push) Has been cancelled
Secret Leaks / trufflehog (push) Has been cancelled
Update Transformers metadata / build_and_package (push) Has been cancelled
Slow tests on important models (on Push - A10) / Model CI (push) Has been cancelled
Check Tiny Models / Check tiny models (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Model CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Pipeline CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Example CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / DeepSpeed CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Trainer/FSDP CI (push) Has been cancelled
Nvidia CI - Flash Attn / Setup (push) Has been cancelled
Nvidia CI - Flash Attn / Model CI (push) Has been cancelled
Nvidia CI / Setup (push) Has been cancelled
Nvidia CI / Model CI (push) Has been cancelled
Nvidia CI / Torch pipeline CI (push) Has been cancelled
Nvidia CI / Example CI (push) Has been cancelled
Nvidia CI / Trainer/FSDP CI (push) Has been cancelled
Nvidia CI / DeepSpeed CI (push) Has been cancelled
Nvidia CI / Quantization CI (push) Has been cancelled
Nvidia CI / Kernels CI (push) Has been cancelled
Doctests / Setup (push) Has been cancelled
Doctests / Call doctest jobs (push) Has been cancelled
Doctests / Send results to webhook (push) Has been cancelled
Extras Smoke Test / Get supported Python versions (push) Has been cancelled
Extras Smoke Test / Test extras on Python ${{ matrix.python-version }} (push) Has been cancelled
Extras Smoke Test / Check Slack token availability (push) Has been cancelled
Extras Smoke Test / Notify failures to Slack (push) Has been cancelled
Self-hosted runner (AMD scheduled CI caller) / Trigger Scheduled AMD CI (push) Has been cancelled
Stale Bot / Close Stale Issues (push) Has been cancelled
123 lines
4.9 KiB
Docker
123 lines
4.9 KiB
Docker
FROM nvidia/cuda:12.6.0-cudnn-devel-ubuntu22.04
|
|
LABEL maintainer="Hugging Face"
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Use login shell to read variables from `~/.profile` (to pass dynamic created variables between RUN commands)
|
|
SHELL ["sh", "-lc"]
|
|
|
|
# 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).
|
|
|
|
ARG PYTORCH='2.11.0'
|
|
# Example: `cu102`, `cu113`, etc.
|
|
ARG CUDA='cu126'
|
|
|
|
# This needs to be compatible with the above `PYTORCH`.
|
|
ARG TORCHCODEC='0.11.0'
|
|
|
|
ARG FLASH_ATTN='false'
|
|
|
|
RUN apt update
|
|
RUN apt install -y git libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg git-lfs
|
|
RUN git lfs install
|
|
RUN python3 -m pip install --no-cache-dir --upgrade pip
|
|
|
|
ARG REF=main
|
|
RUN git clone https://github.com/huggingface/transformers && cd transformers && git checkout $REF
|
|
|
|
RUN python3 -m pip install --no-cache-dir -e ./transformers[dev]
|
|
|
|
# 1. Put several commands in a single `RUN` to avoid image/layer exporting issue. Could be revised in the future.
|
|
# 2. For `torchcodec`, use `cpu` as we don't have `libnvcuvid.so` on the host runner. See https://github.com/meta-pytorch/torchcodec/issues/912
|
|
# **Important**: We need to specify `torchcodec` version if the torch version is not the latest stable one.
|
|
# 3. `set -e` means "exit immediately if any command fails".
|
|
RUN set -e; \
|
|
# Determine torch version
|
|
if [ ${#PYTORCH} -gt 0 ] && [ "$PYTORCH" != "pre" ]; then \
|
|
VERSION="torch==${PYTORCH}.*"; \
|
|
TORCHCODEC_VERSION="torchcodec==${TORCHCODEC}.*"; \
|
|
else \
|
|
VERSION="torch"; \
|
|
TORCHCODEC_VERSION="torchcodec"; \
|
|
fi; \
|
|
\
|
|
# Log the version being installed
|
|
echo "Installing torch version: $VERSION"; \
|
|
\
|
|
# Install PyTorch packages
|
|
if [ "$PYTORCH" != "pre" ]; then \
|
|
python3 -m pip install --no-cache-dir -U \
|
|
$VERSION \
|
|
torchvision \
|
|
torchaudio \
|
|
--extra-index-url https://download.pytorch.org/whl/$CUDA; \
|
|
# We need to specify the version if the torch version is not the latest stable one.
|
|
python3 -m pip install --no-cache-dir -U \
|
|
$TORCHCODEC_VERSION --extra-index-url https://download.pytorch.org/whl/cpu; \
|
|
else \
|
|
python3 -m pip install --no-cache-dir -U --pre \
|
|
torch \
|
|
torchvision \
|
|
torchaudio \
|
|
--extra-index-url https://download.pytorch.org/whl/nightly/$CUDA; \
|
|
python3 -m pip install --no-cache-dir -U --pre \
|
|
torchcodec --extra-index-url https://download.pytorch.org/whl/nightly/cpu; \
|
|
fi
|
|
|
|
RUN python3 -m pip install --no-cache-dir -U timm
|
|
|
|
RUN [ "$PYTORCH" != "pre" ] && python3 -m pip install --no-cache-dir --no-build-isolation git+https://github.com/facebookresearch/detectron2.git || echo "Don't install detectron2 with nightly torch"
|
|
|
|
RUN python3 -m pip install --no-cache-dir pytesseract
|
|
|
|
RUN python3 -m pip install -U "itsdangerous<2.1.0"
|
|
|
|
RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/accelerate@main#egg=accelerate
|
|
|
|
RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/peft@main#egg=peft
|
|
|
|
# For bettertransformer
|
|
RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/optimum@main#egg=optimum
|
|
# For kernels
|
|
RUN python3 -m pip install --no-cache-dir kernels
|
|
|
|
# For video model testing
|
|
RUN python3 -m pip install --no-cache-dir av
|
|
|
|
# Some slow tests require bnb
|
|
RUN python3 -m pip install --no-cache-dir bitsandbytes
|
|
|
|
# Some tests require quanto
|
|
RUN python3 -m pip install --no-cache-dir quanto
|
|
|
|
# After using A10 as CI runner, let's run FA2 tests
|
|
RUN [ "$FLASH_ATTN" != "false" ] && python3 -m pip uninstall -y ninja && python3 -m pip install --no-cache-dir ninja && python3 -m pip install flash-attn --no-cache-dir --no-build-isolation || echo "Don't install FA2 with nightly torch"
|
|
|
|
# TODO (ydshieh): check this again
|
|
# `quanto` will install `ninja` which leads to many `CUDA error: an illegal memory access ...` in some model tests
|
|
# (`deformable_detr`, `rwkv`, `mra`)
|
|
RUN python3 -m pip uninstall -y ninja
|
|
|
|
# For `nougat` tokenizer
|
|
RUN python3 -m pip install --no-cache-dir python-Levenshtein
|
|
|
|
# For `FastSpeech2ConformerTokenizer` tokenizer
|
|
RUN python3 -m pip install --no-cache-dir g2p-en
|
|
|
|
# For serving tests (audio pipelines)
|
|
RUN python3 -m pip install --no-cache-dir librosa python-multipart
|
|
|
|
# For Some bitsandbytes tests
|
|
RUN python3 -m pip install --no-cache-dir einops
|
|
|
|
# For `VibeVoice` (added in PR #40546)
|
|
RUN python3 -m pip install --no-cache-dir diffusers
|
|
|
|
# `kernels` may give different outputs (within 1e-5 range) even with the same model (weights) and the same inputs
|
|
RUN python3 -m pip uninstall -y kernels
|
|
|
|
# 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
|