Skip to content

Commit

Permalink
'cu121's further break down installation steps
Browse files Browse the repository at this point in the history
  • Loading branch information
YanWenKun committed Nov 13, 2024
1 parent 1e602fe commit 32b2a51
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 55 deletions.
53 changes: 37 additions & 16 deletions comfy3d-pt22/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ libnpp-devel-12-1
RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --no-recommends --auto-agree-with-licenses \
cuda-libraries-12-1 \
cuda-libraries-12-1

RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --no-recommends --auto-agree-with-licenses \
cuda-libraries-devel-12-1

ENV PATH="${PATH}:/usr/local/cuda-12.1/bin" \

Check warning on line 60 in comfy3d-pt22/Dockerfile

View workflow job for this annotation

GitHub Actions / build-publish-comfy3d-pt22

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 60 in comfy3d-pt22/Dockerfile

View workflow job for this annotation

GitHub Actions / build-publish-comfy3d-pt22

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
Expand Down Expand Up @@ -96,6 +100,12 @@ python311-scikit-learn \
python311-scipy \
python311-svglib \
python311-tqdm \
&& rm /usr/lib64/python3.11/EXTERNALLY-MANAGED \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100

RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --auto-agree-with-licenses \
Mesa-libGL1 \
Mesa-libEGL-devel \
libgthread-2_0-0 \
Expand All @@ -113,9 +123,7 @@ x264 \
x265 \
google-noto-sans-fonts \
google-noto-sans-cjk-fonts \
google-noto-coloremoji-fonts \
&& rm /usr/lib64/python3.11/EXTERNALLY-MANAGED \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100
google-noto-coloremoji-fonts

################################################################################
# GCC 12
Expand All @@ -142,28 +150,41 @@ cpp12 \

################################################################################
# Python Packages
# Comfy3D doesn't use ONNX Runtime, so this image skipped it.

RUN --mount=type=cache,target=/root/.cache/pip \
pip list \
&& pip install \
--upgrade pip wheel setuptools \
&& pip install \
--dry-run xformers==0.0.25.post1 torch==2.2.2 torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--upgrade pip wheel setuptools

ARG PIP_INDEX_URL="https://download.pytorch.org/whl/cu121"
ARG PIP_EXTRA_INDEX_URL="https://pypi.org/simple"

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers==0.0.25.post1 torch==2.2.2 torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--dry-run xformers==0.0.25.post1 torch==2.2.2 torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
xformers==0.0.25.post1 torch==2.2.2 torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--no-deps torch==2.2.2

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers==0.0.25.post1 torch==2.2.2 torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps torch==2.2.2 nvidia-cudnn-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps torch==2.2.2 nvidia-cublas-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
xformers==0.0.25.post1 torch==2.2.2 torchvision torchaudio

ARG PIP_INDEX_URL=
ARG PIP_EXTRA_INDEX_URL=

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
Expand Down
54 changes: 37 additions & 17 deletions comfy3d-pt23/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ libnpp-devel-12-1
RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --no-recommends --auto-agree-with-licenses \
cuda-libraries-12-1 \
cuda-libraries-12-1

RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --no-recommends --auto-agree-with-licenses \
cuda-libraries-devel-12-1

ENV PATH="${PATH}:/usr/local/cuda-12.1/bin" \

Check warning on line 60 in comfy3d-pt23/Dockerfile

View workflow job for this annotation

GitHub Actions / build-publish-comfy3d-pt23

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

Check warning on line 60 in comfy3d-pt23/Dockerfile

View workflow job for this annotation

GitHub Actions / build-publish-comfy3d-pt23

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
Expand Down Expand Up @@ -96,6 +100,12 @@ python311-scikit-learn \
python311-scipy \
python311-svglib \
python311-tqdm \
&& rm /usr/lib64/python3.11/EXTERNALLY-MANAGED \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100

RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --auto-agree-with-licenses \
Mesa-libGL1 \
Mesa-libEGL-devel \
libgthread-2_0-0 \
Expand All @@ -105,7 +115,6 @@ git \
aria2 \
fish \
fd \
which \
vim \
opencv \
opencv-devel \
Expand All @@ -114,9 +123,7 @@ x264 \
x265 \
google-noto-sans-fonts \
google-noto-sans-cjk-fonts \
google-noto-coloremoji-fonts \
&& rm /usr/lib64/python3.11/EXTERNALLY-MANAGED \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100
google-noto-coloremoji-fonts

################################################################################
# GCC 12
Expand All @@ -142,28 +149,41 @@ cpp12 \

################################################################################
# Python Packages
# Comfy3D doesn't use ONNX Runtime, so this image skipped it.

RUN --mount=type=cache,target=/root/.cache/pip \
pip list \
&& pip install \
--upgrade pip wheel setuptools \
&& pip install \
--dry-run xformers==0.0.26.post1 torch==2.3.0 torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--upgrade pip wheel setuptools

ARG PIP_INDEX_URL="https://download.pytorch.org/whl/cu121"
ARG PIP_EXTRA_INDEX_URL="https://pypi.org/simple"

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers==0.0.26.post1 torch==2.3.0 torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--dry-run xformers==0.0.26.post1 torch==2.3.0 torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
xformers==0.0.26.post1 torch==2.3.0 torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--no-deps torch==2.3.0

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers==0.0.26.post1 torch==2.3.0 torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps torch==2.3.0 nvidia-cudnn-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps torch==2.3.0 nvidia-cublas-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
xformers==0.0.26.post1 torch==2.3.0 torchvision torchaudio

ARG PIP_INDEX_URL=
ARG PIP_EXTRA_INDEX_URL=

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
Expand Down
76 changes: 63 additions & 13 deletions cu121-megapak/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ libnpp-devel-12-1
RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --no-recommends --auto-agree-with-licenses \
cuda-libraries-12-1 \
cuda-libraries-12-1

RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --no-recommends --auto-agree-with-licenses \
cuda-libraries-devel-12-1

ENV PATH="${PATH}:/usr/local/cuda-12.1/bin" \
Expand Down Expand Up @@ -96,6 +100,12 @@ python311-scikit-learn \
python311-scipy \
python311-svglib \
python311-tqdm \
&& rm /usr/lib64/python3.11/EXTERNALLY-MANAGED \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100

RUN --mount=type=cache,target=/var/cache/zypp \
zypper --gpg-auto-import-keys \
install --no-confirm --auto-agree-with-licenses \
Mesa-libGL1 \
Mesa-libEGL-devel \
libgthread-2_0-0 \
Expand All @@ -113,9 +123,7 @@ x264 \
x265 \
google-noto-sans-fonts \
google-noto-sans-cjk-fonts \
google-noto-coloremoji-fonts \
&& rm /usr/lib64/python3.11/EXTERNALLY-MANAGED \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100
google-noto-coloremoji-fonts

################################################################################
# GCC 12
Expand Down Expand Up @@ -146,11 +154,49 @@ cpp12 \
RUN --mount=type=cache,target=/root/.cache/pip \
pip list \
&& pip install \
--upgrade pip wheel setuptools \
&& pip install \
xformers torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--upgrade pip wheel setuptools

ARG PIP_INDEX_URL="https://download.pytorch.org/whl/cu121"
ARG PIP_EXTRA_INDEX_URL="https://pypi.org/simple"

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--dry-run xformers torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch nvidia-cudnn-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch nvidia-cublas-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch triton

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch nvidia-cusparse-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch nvidia-nccl-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
xformers torchvision torchaudio

ARG PIP_INDEX_URL=
ARG PIP_EXTRA_INDEX_URL=

# Bind libs (.so files)
# Even we have CUDA installed by Zypper, we still need to install CUDA libs for Python in order to run PyTorch.
Expand All @@ -176,10 +222,14 @@ COPY builder-scripts/. /builder-scripts/
# Deps for ComfyUI & custom nodes
RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
-r /builder-scripts/pak3.txt \
&& pip install \
-r /builder-scripts/pak5.txt \
&& pip install \
-r /builder-scripts/pak3.txt

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
-r /builder-scripts/pak5.txt

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
-r /builder-scripts/pak7.txt \
&& pip list

Expand Down
43 changes: 34 additions & 9 deletions cu121/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,48 @@ RUN --mount=type=cache,target=/root/.cache/pip \
# Install xFormers (stable version, will specify PyTorch version),
# and Torchvision + Torchaudio (will downgrade to match xFormers' PyTorch version).
# Break down the steps, so we have more but smaller image layers.

ARG PIP_INDEX_URL="https://download.pytorch.org/whl/cu121"
ARG PIP_EXTRA_INDEX_URL="https://pypi.org/simple"

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--dry-run xformers torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch torchvision torchaudio

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--dry-run xformers torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--no-deps xformers torch nvidia-cudnn-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--no-deps xformers torch nvidia-cublas-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
xformers torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 \
--extra-index-url https://pypi.org/simple
--no-deps xformers torch triton

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch nvidia-cusparse-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
--no-deps xformers torch nvidia-nccl-cu12

RUN --mount=type=cache,target=/root/.cache/pip \
pip install \
xformers torchvision torchaudio

ARG PIP_INDEX_URL=
ARG PIP_EXTRA_INDEX_URL=

# Dependencies for frequently-used
# (Do this firstly so PIP won't be solving too many deps at one time)
Expand Down

0 comments on commit 32b2a51

Please sign in to comment.