2023-12-05 21:15:21 +00:00
|
|
|
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu20.04
|
2020-03-04 16:45:57 +00:00
|
|
|
LABEL maintainer="Hugging Face"
|
|
|
|
|
|
2022-02-23 20:48:19 +00:00
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
2020-03-04 16:45:57 +00:00
|
|
|
|
2022-02-23 20:48:19 +00:00
|
|
|
RUN apt update
|
|
|
|
|
RUN apt install -y git libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg
|
|
|
|
|
RUN python3 -m pip install --no-cache-dir --upgrade pip
|
2020-03-04 16:45:57 +00:00
|
|
|
|
2022-03-25 13:12:23 +00:00
|
|
|
ARG REF=main
|
2022-02-23 20:48:19 +00:00
|
|
|
RUN git clone https://github.com/huggingface/transformers && cd transformers && git checkout $REF
|
2020-10-06 13:23:32 +00:00
|
|
|
|
2022-02-23 20:48:19 +00:00
|
|
|
# If set to nothing, will install the latest version
|
2024-05-15 17:31:52 +00:00
|
|
|
ARG PYTORCH='2.3.0'
|
2022-06-07 09:53:05 +00:00
|
|
|
ARG TORCH_VISION=''
|
|
|
|
|
ARG TORCH_AUDIO=''
|
2022-12-12 19:04:56 +00:00
|
|
|
# Example: `cu102`, `cu113`, etc.
|
2023-12-05 21:15:21 +00:00
|
|
|
ARG CUDA='cu121'
|
2022-06-07 09:53:05 +00:00
|
|
|
|
2023-03-24 13:29:05 +00:00
|
|
|
RUN [ ${#PYTORCH} -gt 0 ] && VERSION='torch=='$PYTORCH'.*' || VERSION='torch'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA
|
|
|
|
|
RUN [ ${#TORCH_VISION} -gt 0 ] && VERSION='torchvision=='TORCH_VISION'.*' || VERSION='torchvision'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA
|
|
|
|
|
RUN [ ${#TORCH_AUDIO} -gt 0 ] && VERSION='torchaudio=='TORCH_AUDIO'.*' || VERSION='torchaudio'; python3 -m pip install --no-cache-dir -U $VERSION --extra-index-url https://download.pytorch.org/whl/$CUDA
|
2020-03-04 16:45:57 +00:00
|
|
|
|
2023-10-05 13:33:35 +00:00
|
|
|
RUN python3 -m pip install --no-cache-dir -e ./transformers[dev-torch,testing,video]
|
|
|
|
|
|
2022-02-23 20:48:19 +00:00
|
|
|
RUN python3 -m pip uninstall -y tensorflow flax
|
|
|
|
|
|
2022-10-26 15:06:46 +00:00
|
|
|
RUN python3 -m pip install --no-cache-dir git+https://github.com/facebookresearch/detectron2.git pytesseract
|
2022-03-01 13:55:11 +00:00
|
|
|
RUN python3 -m pip install -U "itsdangerous<2.1.0"
|
2022-02-23 20:48:19 +00: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
|