Dockerfile 1.47 KB
Newer Older
1
2
3
4
FROM nvidia/cuda:12.1.0-runtime-ubuntu20.04
LABEL maintainer="Hugging Face"
LABEL repository="diffusers"

5
ARG PYTHON_VERSION=3.10
6
7
8
9
10
11
12
ENV DEBIAN_FRONTEND=noninteractive
ENV MINIMUM_SUPPORTED_TORCH_VERSION="2.1.0"
ENV MINIMUM_SUPPORTED_TORCHVISION_VERSION="0.16.0"
ENV MINIMUM_SUPPORTED_TORCHAUDIO_VERSION="2.1.0"

RUN apt-get -y update \
    && apt-get install -y software-properties-common \
13
14
    && add-apt-repository ppa:deadsnakes/ppa && \
    apt-get update
15
16
17
18
19
20
21

RUN apt install -y bash \
    build-essential \
    git \
    git-lfs \
    curl \
    ca-certificates \
22
    libglib2.0-0 \
23
24
    libsndfile1-dev \
    libgl1 \
25
    python3 \
26
    python3-pip \
27
28
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
29

30
31
32
33
34
35
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"
ENV VIRTUAL_ENV="/opt/venv"
ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
36
37

# pre-install the heavy dependencies (these can later be overridden by the deps from setup.py)
38
RUN uv pip install --no-cache-dir \
39
40
    torch==$MINIMUM_SUPPORTED_TORCH_VERSION \
    torchvision==$MINIMUM_SUPPORTED_TORCHVISION_VERSION \
41
42
43
44
45
46
    torchaudio==$MINIMUM_SUPPORTED_TORCHAUDIO_VERSION

RUN uv pip install --no-cache-dir "git+https://github.com/huggingface/diffusers.git@main#egg=diffusers[test]"

# Extra dependencies
RUN uv pip install --no-cache-dir \
47
48
    accelerate \
    numpy==1.26.4 \
49
    pytorch-lightning \
50
    hf_xet
51
52

CMD ["/bin/bash"]