| FROM nvidia/cuda:12.6.0-cudnn-devel-ubuntu22.04 |
| LABEL maintainer="Hugging Face" |
|
|
| ARG DEBIAN_FRONTEND=noninteractive |
|
|
| |
| SHELL ["sh", "-lc"] |
|
|
| |
| |
|
|
| ARG PYTORCH='2.9.0' |
| |
| ARG CUDA='cu126' |
|
|
| |
| ARG TORCHCODEC='0.8.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] |
|
|
| |
| |
| |
| |
| RUN set -e; \ |
| |
| if [ ${ |
| VERSION="torch==${PYTORCH}.*"; \ |
| TORCHCODEC_VERSION="torchcodec==${TORCHCODEC}.*"; \ |
| else \ |
| VERSION="torch"; \ |
| TORCHCODEC_VERSION="torchcodec"; \ |
| fi; \ |
| \ |
| |
| echo "Installing torch version: $VERSION"; \ |
| \ |
| |
| if [ "$PYTORCH" != "pre" ]; then \ |
| 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 \ |
| $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 |
|
|
| RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/peft@main |
|
|
| |
| RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/optimum@main |
| |
| RUN python3 -m pip install --no-cache-dir git+https://github.com/huggingface/kernels@main |
|
|
| |
| RUN python3 -m pip install --no-cache-dir av |
|
|
| |
| RUN python3 -m pip install --no-cache-dir bitsandbytes |
|
|
| |
| RUN python3 -m pip install --no-cache-dir quanto |
|
|
| |
| 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" |
|
|
| |
| |
| |
| RUN python3 -m pip uninstall -y ninja |
|
|
| |
| RUN python3 -m pip install --no-cache-dir python-Levenshtein |
|
|
| |
| RUN python3 -m pip install --no-cache-dir g2p-en |
|
|
| |
| RUN python3 -m pip install --no-cache-dir einops |
|
|
| |
| RUN python3 -m pip install --no-cache-dir liger-kernel |
|
|
| |
| RUN python3 -m pip uninstall -y kernels |
|
|
| |
| |
| RUN cd transformers && python3 setup.py develop |
|
|