Dockerfile 1.79 KB
Newer Older
1
FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04
2
3
LABEL maintainer="Hugging Face"

4
ARG DEBIAN_FRONTEND=noninteractive
5

6
7
8
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
9

10
ARG REF=main
11
RUN git clone https://github.com/huggingface/transformers && cd transformers && git checkout $REF
12
RUN python3 -m pip install --no-cache-dir -e ./transformers[dev-torch,testing]
13

14
# If set to nothing, will install the latest version
15
ARG PYTORCH='1.11.0'
16
17
18
19
20
21
ARG TORCH_VISION=''
ARG TORCH_AUDIO=''

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/cu113
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/cu113
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/cu113
22

23
24
RUN python3 -m pip uninstall -y tensorflow flax

25
RUN python3 -m pip install --no-cache-dir torch-scatter -f https://data.pyg.org/whl/torch-$(python3 -c "from torch import version; print(version.__version__.split('+')[0])")+cu113.html
26
RUN python3 -m pip install --no-cache-dir git+https://github.com/facebookresearch/detectron2.git pytesseract https://github.com/kpu/kenlm/archive/master.zip
27
RUN python3 -m pip install -U "itsdangerous<2.1.0"
28
29
30
31

# 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