From b53c5bf803798adeb67c75aec90ae3acf6cb3134 Mon Sep 17 00:00:00 2001 From: YAN Wenkun Date: Wed, 18 Dec 2024 09:17:40 +0800 Subject: [PATCH] (WIP) attemp to build pt25 with TRELLIS --- pt25-cu124/README.txt | 6 ++-- .../!FIRST_RUN-compile-install.bat | 9 ++++++ pt25-cu124/requirements4.txt | 1 - pt25-cu124/requirements7.txt | 4 --- pt25-cu124/requirements8.txt | 6 ++-- pt25-cu124/requirements9.txt | 2 ++ pt25-cu124/requirementsA.txt | 4 +++ pt25-cu124/stage1.sh | 14 +++++----- pt25-cu124/stage2.sh | 28 +++++++++++++++---- 9 files changed, 53 insertions(+), 21 deletions(-) delete mode 100644 pt25-cu124/requirements7.txt create mode 100644 pt25-cu124/requirements9.txt diff --git a/pt25-cu124/README.txt b/pt25-cu124/README.txt index 17ab81a..8352a31 100644 --- a/pt25-cu124/README.txt +++ b/pt25-cu124/README.txt @@ -1,3 +1,5 @@ -This build is working, but not released yet. +How to build: -If you need, simply fork this repo and go to "Actions" page, then you can build it using GitHub Actions. +1. Fork this repo on GitHub +2. Run the build operations in "Actions" page +3. Download the artifact in "Releases" page diff --git a/pt25-cu124/attachments/!FIRST_RUN-compile-install.bat b/pt25-cu124/attachments/!FIRST_RUN-compile-install.bat index b5d4ec9..490f276 100644 --- a/pt25-cu124/attachments/!FIRST_RUN-compile-install.bat +++ b/pt25-cu124/attachments/!FIRST_RUN-compile-install.bat @@ -2,6 +2,8 @@ @REM You don't need to add the "+PTX". Here it works as a fail-safe (providing forward compatibility). set TORCH_CUDA_ARCH_LIST=6.1+PTX +@REM =========================================================================== + @REM Compile-install PyTorch3D @REM PyTorch3D on Windows works best through compile-install. Binary-install will fail on some workflows. @REM e.g. "CUDA error: no kernel image is available for execution on the device" @@ -31,3 +33,10 @@ set PATH=%PATH%;%~dp0\python_embeded\Scripts .\python_embeded\python.exe -s -m pip install --force-reinstall ^ .\extras\vox2seq + +@REM Compile-install Flash Attention for TRELLIS +@REM flash-attn can ONLY be used on Ampere and later GPUs (RTX 30 series and beyond) +@REM Safe to remove this if you are not using RTX 30/40 or A100+. + +.\python_embeded\python.exe -s -m pip install ^ + flash-attn diff --git a/pt25-cu124/requirements4.txt b/pt25-cu124/requirements4.txt index aab5d1e..354cfb3 100644 --- a/pt25-cu124/requirements4.txt +++ b/pt25-cu124/requirements4.txt @@ -3,7 +3,6 @@ aiohttp diffusers einops fairscale -flash-attn ftfy huggingface-hub[hf-transfer] imageio diff --git a/pt25-cu124/requirements7.txt b/pt25-cu124/requirements7.txt deleted file mode 100644 index babb8a1..0000000 --- a/pt25-cu124/requirements7.txt +++ /dev/null @@ -1,4 +0,0 @@ -# https://pip.pypa.io/en/stable/reference/requirements-file-format/ -# https://github.com/rusty1s/pytorch_scatter?tab=readme-ov-file#binaries ---find-links https://data.pyg.org/whl/torch-2.5.1%2Bcu124.html -torch-scatter diff --git a/pt25-cu124/requirements8.txt b/pt25-cu124/requirements8.txt index 5049288..babb8a1 100644 --- a/pt25-cu124/requirements8.txt +++ b/pt25-cu124/requirements8.txt @@ -1,2 +1,4 @@ ---find-links https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.5.1_cu124.html -kaolin +# https://pip.pypa.io/en/stable/reference/requirements-file-format/ +# https://github.com/rusty1s/pytorch_scatter?tab=readme-ov-file#binaries +--find-links https://data.pyg.org/whl/torch-2.5.1%2Bcu124.html +torch-scatter diff --git a/pt25-cu124/requirements9.txt b/pt25-cu124/requirements9.txt new file mode 100644 index 0000000..5049288 --- /dev/null +++ b/pt25-cu124/requirements9.txt @@ -0,0 +1,2 @@ +--find-links https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.5.1_cu124.html +kaolin diff --git a/pt25-cu124/requirementsA.txt b/pt25-cu124/requirementsA.txt index 2356b19..3a72a2e 100644 --- a/pt25-cu124/requirementsA.txt +++ b/pt25-cu124/requirementsA.txt @@ -3,3 +3,7 @@ numpy==1.26.4 # For ComfyUI-Manager matrix-client==0.4.0 + +# For TRELLIS demo +gradio==4.44.1 +gradio_litmodel3d==0.0.1 diff --git a/pt25-cu124/stage1.sh b/pt25-cu124/stage1.sh index 4f2dde8..07b6f9e 100644 --- a/pt25-cu124/stage1.sh +++ b/pt25-cu124/stage1.sh @@ -28,11 +28,11 @@ mv ComfyUI-3D-Pack-0880fa8d2945b8abb990ad768e0cfe704e0d025e ComfyUI-3D-Pack rm ComfyUI-3D-Pack-0880fa8d2945b8abb990ad768e0cfe704e0d025e.zip cd "$workdir" -curl -sSL https://github.com/MrForExample/Comfy3D_Pre_Builds/archive/606a5cf09aef1ecaf0092f6b645ac46bc2772d86.zip \ - -o Comfy3D_Pre_Builds-606a5cf09aef1ecaf0092f6b645ac46bc2772d86.zip -unzip -q Comfy3D_Pre_Builds-606a5cf09aef1ecaf0092f6b645ac46bc2772d86.zip -mv Comfy3D_Pre_Builds-606a5cf09aef1ecaf0092f6b645ac46bc2772d86 Comfy3D_Pre_Builds -rm Comfy3D_Pre_Builds-606a5cf09aef1ecaf0092f6b645ac46bc2772d86.zip +curl -sSL https://github.com/MrForExample/Comfy3D_Pre_Builds/archive/ac9f238f092b94ba319ce06f3ccd80b9d0f6c8c4.zip \ + -o Comfy3D_Pre_Builds-ac9f238f092b94ba319ce06f3ccd80b9d0f6c8c4.zip +unzip -q Comfy3D_Pre_Builds-ac9f238f092b94ba319ce06f3ccd80b9d0f6c8c4.zip +mv Comfy3D_Pre_Builds-ac9f238f092b94ba319ce06f3ccd80b9d0f6c8c4 Comfy3D_Pre_Builds +rm Comfy3D_Pre_Builds-ac9f238f092b94ba319ce06f3ccd80b9d0f6c8c4.zip # Header files for ComfyUI-3D-Pack # Do this firstly (in a clean python_embeded folder) @@ -58,12 +58,12 @@ $pip_exe install -r "$workdir"/requirements3.txt $pip_exe install -r "$workdir"/requirements4.txt $pip_exe install -r "$workdir"/requirements5.txt $pip_exe install -r "$workdir"/requirements6.txt -$pip_exe install -r "$workdir"/requirements7.txt -$pip_exe install -r "$workdir"/requirements8.txt rm "$workdir"/Comfy3D_Pre_Builds/_Build_Wheels/_Wheels_win_py312_torch2.5.1_cu124/torch_scatter-2.1.2-cp312-cp312-win_amd64.whl $pip_exe install "$workdir"/Comfy3D_Pre_Builds/_Build_Wheels/_Wheels_win_py312_torch2.5.1_cu124/*.whl +$pip_exe install -r "$workdir"/requirements8.txt +$pip_exe install -r "$workdir"/requirements9.txt $pip_exe install -r "$workdir"/requirementsA.txt # Add Ninja binary (replacing PIP Ninja) diff --git a/pt25-cu124/stage2.sh b/pt25-cu124/stage2.sh index 4fcd645..8ce7135 100644 --- a/pt25-cu124/stage2.sh +++ b/pt25-cu124/stage2.sh @@ -14,11 +14,9 @@ mkdir -p "$workdir"/Comfy3D_WinPortable export HF_HUB_CACHE="$workdir/Comfy3D_WinPortable/HuggingFaceHub" mkdir -p "$HF_HUB_CACHE" -# ComfyUI main app +# ComfyUI main app (latest) git clone https://github.com/comfyanonymous/ComfyUI.git \ "$workdir"/Comfy3D_WinPortable/ComfyUI -cd "$workdir"/Comfy3D_WinPortable/ComfyUI -git reset --hard "v0.3.7" # CUSTOM NODES cd "$workdir"/Comfy3D_WinPortable/ComfyUI/custom_nodes @@ -30,8 +28,8 @@ rm ./ComfyUI-3D-Pack/requirements.txt rm ./ComfyUI-3D-Pack/install.py rm -rf ./ComfyUI-3D-Pack/_Pre_Builds -# Install ComfyUI-Manager but disable it by default -# Not this time +# ComfyUI-Manager +# This time not disable it $gcs https://github.com/ltdrdata/ComfyUI-Manager.git # mv ComfyUI-Manager ComfyUI-Manager.disabled @@ -87,6 +85,26 @@ mv "$workdir"/Comfy3D_WinPortable/ComfyUI/custom_nodes/ComfyUI-3D-Pack/_Example_ # Move source files needed by user compile-install mv "$workdir"/Comfy3D_Pre_Builds/_Libs/* "$workdir"/Comfy3D_WinPortable/extras/ +# Download more source repos +cd "$workdir"/Comfy3D_WinPortable/extras/ + +curl -sSL https://github.com/EasternJournalist/utils3d/archive/refs/heads/main.zip \ + -o temp.zip +unzip -q temp.zip +mv utils3d-main utils3d +rm temp.zip + + +cd "$workdir"/Comfy3D_WinPortable/extras/ + +curl -sSL https://github.com/autonomousvision/mip-splatting.git \ + -o temp.zip +unzip -q temp.zip +mv TRELLIS-main TRELLIS +rm temp.zip + + + # Copy & overwrite attachments cp -rf "$workdir"/attachments/* \ "$workdir"/Comfy3D_WinPortable/