diff --git a/pt25-cu124/attachments/!FIRST_RUN-compile-install.bat b/pt25-cu124/attachments/!FIRST_RUN-compile-install.bat index 24a6a2e..db70b14 100644 --- a/pt25-cu124/attachments/!FIRST_RUN-compile-install.bat +++ b/pt25-cu124/attachments/!FIRST_RUN-compile-install.bat @@ -1,16 +1,17 @@ @REM Edit this to your GPU arch. @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 =========================================================================== +set CMAKE_ARGS=-DBUILD_opencv_world=ON -DWITH_CUDA=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_NVCUVID=ON +set PATH=%PATH%;%~dp0\python_embeded\Scripts + @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" -set CMAKE_ARGS=-DBUILD_opencv_world=ON -DWITH_CUDA=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_NVCUVID=ON -set PATH=%PATH%;%~dp0\python_embeded\Scripts - .\python_embeded\python.exe -s -m pip install --force-reinstall ^ .\extras\pytorch3d @@ -39,20 +40,9 @@ set PATH=%PATH%;%~dp0\python_embeded\Scripts .\extras\diff-gaussian-rasterization @REM Differential Octree Rasterization -@REM Note that PIP will auto git clone submodules, no need to explicit clone it. -.\python_embeded\python.exe -s -m pip install ^ - .\extras\diffoctreerast - -@REM (Optional) Flash Attention -@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+. - -@REM Limit Ninja jobs to avoid OOM - -set MAX_JOBS=4 .\python_embeded\python.exe -s -m pip install ^ - flash-attn --no-build-isolation + .\extras\diffoctreerast @REM =========================================================================== diff --git a/pt25-cu124/attachments/reinstall-deps-for-3d.bat b/pt25-cu124/attachments/reinstall-deps-for-3d.bat index 1855fee..5672e7c 100644 --- a/pt25-cu124/attachments/reinstall-deps-for-3d.bat +++ b/pt25-cu124/attachments/reinstall-deps-for-3d.bat @@ -20,15 +20,23 @@ pause @echo on -@REM In order to save your time on compiling, edit this line according to your GPU arch. +@REM =========================================================================== + +@REM [IMPORTANT] To save your time on compiling, edit this line according to your GPU arch. @REM Ref: https://github.com/ashawkey/stable-dreamfusion/issues/360#issuecomment-2292510049 @REM Ref: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/ + set TORCH_CUDA_ARCH_LIST=5.2+PTX;6.0;6.1+PTX;7.5;8.0;8.6;8.9+PTX -set CMAKE_ARGS=-DBUILD_opencv_world=ON -DWITH_CUDA=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_NVCUVID=ON +@REM =========================================================================== set PATH=%PATH%;%~dp0\python_embeded\Scripts +set CMAKE_ARGS=-DBUILD_opencv_world=ON -DWITH_CUDA=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_NVCUVID=ON + +.\python_embeded\python.exe -s -m pip install --force-reinstall ^ + spconv-cu124 + if not exist ".\tmp_build" mkdir tmp_build .\python_embeded\python.exe -s -m pip install numpy==1.26.4 @@ -36,6 +44,9 @@ if not exist ".\tmp_build" mkdir tmp_build git clone --depth=1 https://github.com/MrForExample/Comfy3D_Pre_Builds.git ^ .\tmp_build\Comfy3D_Pre_Builds +git clone --depth=1 https://github.com/autonomousvision/mip-splatting.git ^ + .\tmp_build\mip-splatting + .\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ .\tmp_build\Comfy3D_Pre_Builds\_Libs\pointnet2_ops @@ -46,7 +57,14 @@ git clone --depth=1 https://github.com/MrForExample/Comfy3D_Pre_Builds.git ^ .\tmp_build\Comfy3D_Pre_Builds\_Libs\vox2seq .\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ - git+https://github.com/ashawkey/diff-gaussian-rasterization.git + .\tmp_build\mip-splatting\submodules\diff-gaussian-rasterization + +@REM Note that PIP will auto git clone submodules, no need to explicit clone it. +.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ + git+https://github.com/JeffreyXiang/diffoctreerast.git + +.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ + git+https://github.com/EasternJournalist/utils3d.git .\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ git+https://github.com/ashawkey/kiuikit.git @@ -63,4 +81,17 @@ del .\tmp_build\numpy-2*.whl for %%i in (.\tmp_build\*.whl) do .\python_embeded\python.exe -s -m pip install --force-reinstall "%%i" +@REM =========================================================================== + +@REM (Optional) Flash Attention for TRELLIS demo +@REM "flash-attn" can ONLY be used on Ampere and later GPUs (RTX 30 series / A100 and beyond). +@REM WARNING: VERY long build time! + +@REM Limit Ninja jobs to avoid OOM. If have RAM larger than 96GB, just remove this line. +rem set MAX_JOBS=4 + +rem .\python_embeded\python.exe -s -m pip install flash-attn --no-build-isolation + +@REM =========================================================================== + .\python_embeded\python.exe -s -m pip install numpy==1.26.4 diff --git a/pt25-cu124/attachments/run.bat b/pt25-cu124/attachments/run.bat index 51766b3..6845d72 100644 --- a/pt25-cu124/attachments/run.bat +++ b/pt25-cu124/attachments/run.bat @@ -20,6 +20,9 @@ rem set HF_HUB_ENABLE_HF_TRANSFER=1 @REM This command redirects HuggingFace-Hub to download model files in this folder. set HF_HUB_CACHE=%~dp0\HuggingFaceHub +@REM This command redirects Pytorch Hub to download model files in this folder. +set TORCH_HOME=%~dp0\TorchHome + @REM This command will set PATH environment variable. set PATH=%PATH%;%~dp0\python_embeded\Scripts diff --git a/pt25-cu124/attachments/run_trellis_demo.sh b/pt25-cu124/attachments/run_trellis_demo.sh index 53e347f..f2bdf42 100644 --- a/pt25-cu124/attachments/run_trellis_demo.sh +++ b/pt25-cu124/attachments/run_trellis_demo.sh @@ -1,7 +1,7 @@ #!/bin/bash set -eu -# The TRELLIS demo was written in Linux context in mind. So here we use bash to run it. +# The TRELLIS demo was written with Linux context in mind. So here we use bash to run it. # You need to install with (installed by default). # Download: https://git-scm.com/download/win @@ -9,18 +9,21 @@ set -eu # Edit this first! According to your GPU model. export TORCH_CUDA_ARCH_LIST="6.1+PTX" -# "flash-attn" can ONLY be used on Ampere and later GPUs (RTX 30 series and beyond). -# Change it to "xformers" if you can't start the program. -export ATTN_BACKEND="flash-attn" +################################################################################ +# Optional Optimizations -# "auto" will be faster but will do benchmarking at the beginning. # If run only once, set to "native". -export SPCONV_ALGO="auto" +# "auto" will be faster but will do benchmarking at the beginning. +export SPCONV_ALGO="native" +# Default to "xformers" for compatibility +# "flash-attn" for higher performance. +# Flash Attention can ONLY be used on Ampere and later GPUs (RTX 30 series / A100 and beyond). +export ATTN_BACKEND="xformers" ################################################################################ -# To set proxy, edit and uncomment the lines below +# To set proxy, uncomment and edit the lines below # (remove '#' in the beginning of line). #export HTTP_PROXY=http://localhost:1081 #export HTTPS_PROXY=$HTTP_PROXY @@ -40,19 +43,16 @@ export SPCONV_ALGO="auto" #export PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" #export HF_ENDPOINT="https://hf-mirror.com" -# To set HuggingFace Access Token, uncomment and edit the line below. -# https://huggingface.co/settings/tokens -#export HF_TOKEN= - -# To enable HuggingFace Hub's experimental high-speed file transfer, uncomment the line below. -# https://huggingface.co/docs/huggingface_hub/hf_transfer -#export HF_HUB_ENABLE_HF_TRANSFER=1 +################################################################################ workdir="$(pwd)" # This command redirects HuggingFace-Hub to download model files in this folder. export HF_HUB_CACHE="$workdir/HuggingFaceHub" +# This command redirects Pytorch Hub to download model files in this folder. +export TORCH_HOME="$workdir/TorchHome" + # This command will set PATH environment variable. export PATH="${PATH}:$workdir/python_embeded/Scripts" @@ -76,4 +76,10 @@ fi ; $workdir/python_embeded/Scripts/huggingface-cli.exe download JeffreyXiang/TRELLIS-image-large # Run the TRELLIS official Gradio demo -./python_embeded/python.exe -s TRELLIS/app.py + +echo "########################################" +echo "[INFO] Starting TRELLIS demo..." +echo "########################################" + +cd TRELLIS +../python_embeded/python.exe -s app.py diff --git "a/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/!\351\246\226\346\254\241\350\277\220\350\241\214-\347\274\226\350\257\221\345\256\211\350\243\205\344\276\235\350\265\226\351\241\271.bat" "b/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/!\351\246\226\346\254\241\350\277\220\350\241\214-\347\274\226\350\257\221\345\256\211\350\243\205\344\276\235\350\265\226\351\241\271.bat" index d60e9cf..6956608 100644 --- "a/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/!\351\246\226\346\254\241\350\277\220\350\241\214-\347\274\226\350\257\221\345\256\211\350\243\205\344\276\235\350\265\226\351\241\271.bat" +++ "b/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/!\351\246\226\346\254\241\350\277\220\350\241\214-\347\274\226\350\257\221\345\256\211\350\243\205\344\276\235\350\265\226\351\241\271.bat" @@ -1,34 +1,52 @@ @REM 编辑为你的 GPU 对应架构 @REM 修改时无需保留 "+PTX" ,其用于向前兼容,防止用户忘了该步骤。 + set TORCH_CUDA_ARCH_LIST=6.1+PTX -@REM 编译安装 PyTorch3D -@REM PyTorch3D 对 Windows 不甚友好,所有二进制安装都可能在某个节点报错,极难排查,故最好提前编译安装。 +@REM 使用清华 PyPI 源 +set PIP_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple + +@REM =========================================================================== -set CMAKE_ARGS=-DBUILD_opencv_world=ON -DWITH_CUDA=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_NVCUVID=ON set PATH=%PATH%;%~dp0\python_embeded\Scripts +set CMAKE_ARGS=-DBUILD_opencv_world=ON -DWITH_CUDA=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_NVCUVID=ON -set PIP_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple +@REM 编译安装 PyTorch3D +@REM PyTorch3D 对 Windows 不甚友好,所有二进制安装都可能在某个节点报错,极难排查,故最好提前编译安装。 .\python_embeded\python.exe -s -m pip install --force-reinstall ^ - "git+https://ghp.ci/https://github.com/facebookresearch/pytorch3d.git" + .\extras\pytorch3d @REM 编译安装 pointnet2_ops ,该组件用于 Triplane Gaussian .\python_embeded\python.exe -s -m pip install --force-reinstall ^ .\extras\pointnet2_ops -@REM 编译安装 diff-gaussian-rasterization ,该组件用于 Triplane Gaussian -.\python_embeded\python.exe -s -m pip install --force-reinstall ^ - "git+https://ghp.ci/https://github.com/ashawkey/diff-gaussian-rasterization.git" - -@REM 编译安装 simple-knn +@REM 编译安装 simple-knn ,该组件用于 Gaussian Splatting .\python_embeded\python.exe -s -m pip install --force-reinstall ^ .\extras\simple-knn -@REM 编译安装 vox2seq ,该组件用于 TRELLIS +@REM =========================================================================== +@REM 用于 TRELLIS 的组件 +@REM 注意我们跳过了 'utils3d' ,该组件不需要本地重新编译 + +@REM vox2seq .\python_embeded\python.exe -s -m pip install --force-reinstall ^ .\extras\vox2seq + +@REM diff-gaussian-rasterization + +.\python_embeded\python.exe -s -m pip install --force-reinstall ^ + .\extras\diff-gaussian-rasterization + +@REM Differential Octree Rasterization + +.\python_embeded\python.exe -s -m pip install ^ + .\extras\diffoctreerast + +@REM =========================================================================== + +.\python_embeded\python.exe -s -m pip install numpy==1.26.4 diff --git "a/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/run_cn.bat" "b/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/run_cn.bat" index 3b68ce2..895b544 100644 --- "a/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/run_cn.bat" +++ "b/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/run_cn.bat" @@ -22,6 +22,9 @@ set HF_ENDPOINT=https://hf-mirror.com @REM 该环境变量指示 HuggingFace Hub 下载模型到"本目录\HuggingFaceHub",而不是"用户\.cache"目录。 set HF_HUB_CACHE=%~dp0\HuggingFaceHub +@REM 该环境变量指示 Pytorch Hub 下载模型到"本目录\TorchHome",而不是"用户\.cache"目录。 +set TORCH_HOME=%~dp0\TorchHome + @REM 该命令配置 PATH 环境变量。 set PATH=%PATH%;%~dp0\python_embeded\Scripts diff --git "a/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/run_trellis_demo_cn.sh" "b/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/run_trellis_demo_cn.sh" new file mode 100644 index 0000000..b0d0800 --- /dev/null +++ "b/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/run_trellis_demo_cn.sh" @@ -0,0 +1,85 @@ +#!/bin/bash +set -eu + +# 因为 TRELLIS 官方 demo 是以 Linux 语境编写的,未考虑跨平台,这里需用 Bash 运行 +# 下载 Git for Windows: https://git-scm.com/download/win +# 并在安装时选择 Git Bash(默认) + +################################################################################ +# 务必根据你的 GPU 型号配置! +export TORCH_CUDA_ARCH_LIST="6.1+PTX" + +################################################################################ +# 性能优化(可选) + +# 如果仅单次运行,使用 "native" 即可 +# 如果长期运行,使用 "auto" 会有更好性能,但一开始会花时间进行性能测试。 +export SPCONV_ALGO="native" + +# 默认使用 "xformers" 以保证兼容性 +# 如果需要高性能,尝试改为 "flash-attn" +# Flash Attention 只能用于 Ampere (RTX 30 系 / A100) 及更新的 GPU +export ATTN_BACKEND="xformers" + +################################################################################ + +# 如需配置代理,取消注释并编辑以下部分 +# (删除行首井号 # ) +#export HTTP_PROXY=http://localhost:1081 +#export HTTPS_PROXY=$HTTP_PROXY +#export http_proxy=$HTTP_PROXY +#export https_proxy=$HTTP_PROXY +#export NO_PROXY="localhost,*.local,*.internal,[::1],fd00::/7, +#10.0.0.0/8,127.0.0.0/8,169.254.0.0/16,172.16.0.0/12,192.168.0.0/16, +#10.*,127.*,169.254.*,172.16.*,172.17.*,172.18.*,172.19.*,172.20.*, +#172.21.*,172.22.*,172.23.*,172.24.*,172.25.*,172.26.*,172.27.*, +#172.28.*,172.29.*,172.30.*,172.31.*,172.32.*,192.168.*, +#*.cn,ghproxy.com,*.ghproxy.com,ghproxy.org,*.ghproxy.org, +#gh-proxy.com,*.gh-proxy.com,ghproxy.net,*.ghproxy.net" +#export no_proxy=$NO_PROXY +#echo "[INFO] Proxy set to $HTTP_PROXY" + +# 配置使用国内镜像站点 +export PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +export HF_ENDPOINT="https://hf-mirror.com" + +################################################################################ + +workdir="$(pwd)" + +# 该环境变量指示 HuggingFace Hub 下载模型到"本目录\HuggingFaceHub",而不是"用户\.cache"目录。 +export HF_HUB_CACHE="$workdir/HuggingFaceHub" + +# 该环境变量指示 Pytorch Hub 下载模型到"本目录\TorchHome",而不是"用户\.cache"目录。 +export TORCH_HOME="$workdir/TorchHome" + +# 该命令配置 PATH 环境变量。 +export PATH="${PATH}:$workdir/python_embeded/Scripts" + +# 该环境变量使 .pyc 缓存文件集中保存在一个文件夹下,而不是随 .py 文件分布。 +export PYTHONPYCACHEPREFIX="$workdir/pycache" + +# 该命令会复制 u2net.onnx 到用户主目录下,以免启动时还需下载。 +if [ ! -f "${HOME}/.u2net/u2net.onnx" ]; then + if [ -f "./extras/u2net.onnx" ]; then + mkdir -p "${HOME}/.u2net" + cp "./extras/u2net.onnx" "${HOME}/.u2net/u2net.onnx" + fi +fi + +# 下载 TRELLIS 模型(不会重复下载) +if [ ! -f "$workdir/python_embeded/Scripts/.hf-hub-reinstalled" ] ; then + $workdir/python_embeded/python.exe -s -m pip install --force-reinstall huggingface-hub + touch "$workdir/python_embeded/Scripts/.hf-hub-reinstalled" +fi ; + +$workdir/python_embeded/Scripts/huggingface-cli.exe download JeffreyXiang/TRELLIS-image-large + +# 运行 TRELLIS 官方 Gradio demo + +echo "########################################" +echo "[INFO] Starting TRELLIS demo..." +echo "########################################" + +cd TRELLIS +../python_embeded/python.exe -s app.py diff --git "a/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/\351\207\215\346\226\260\347\274\226\350\257\221\345\256\211\350\243\2053D-Pack\344\276\235\350\265\226\351\241\271.bat" "b/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/\351\207\215\346\226\260\347\274\226\350\257\221\345\256\211\350\243\2053D-Pack\344\276\235\350\265\226\351\241\271.bat" index fd65164..5ad38ee 100644 --- "a/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/\351\207\215\346\226\260\347\274\226\350\257\221\345\256\211\350\243\2053D-Pack\344\276\235\350\265\226\351\241\271.bat" +++ "b/pt25-cu124/attachments/\344\270\255\346\226\207\350\204\232\346\234\254/\351\207\215\346\226\260\347\274\226\350\257\221\345\256\211\350\243\2053D-Pack\344\276\235\350\265\226\351\241\271.bat" @@ -21,6 +21,11 @@ pause @echo on +@REM 【重要】依照下表,修改为你的 GPU 对应架构,以节约编译时间: +@REM https://github.com/ashawkey/stable-dreamfusion/issues/360#issuecomment-2292510049 +@REM https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/ +set TORCH_CUDA_ARCH_LIST=5.2+PTX;6.0;6.1+PTX;7.5;8.0;8.6;8.9+PTX + @REM 如需配置代理,编辑下两行命令,并取消注释(移除行首的 'rem ')。 rem set HTTP_PROXY=http://localhost:1081 rem set HTTPS_PROXY=http://localhost:1081 @@ -29,15 +34,10 @@ rem set HTTPS_PROXY=http://localhost:1081 set PIP_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple set HF_ENDPOINT=https://hf-mirror.com -@REM 依照下表,修改为你的 GPU 对应架构,以节约编译时间: -@REM https://github.com/ashawkey/stable-dreamfusion/issues/360#issuecomment-2292510049 -@REM https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/ -set TORCH_CUDA_ARCH_LIST=5.2+PTX;6.0;6.1+PTX;7.5;8.0;8.6;8.9+PTX +set PATH=%PATH%;%~dp0\python_embeded\Scripts set CMAKE_ARGS=-DBUILD_opencv_world=ON -DWITH_CUDA=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_NVCUVID=ON -set PATH=%PATH%;%~dp0\python_embeded\Scripts - if not exist ".\tmp_build" mkdir tmp_build .\python_embeded\python.exe -s -m pip install numpy==1.26.4 @@ -45,6 +45,9 @@ if not exist ".\tmp_build" mkdir tmp_build git clone --depth=1 https://ghp.ci/https://github.com/MrForExample/Comfy3D_Pre_Builds.git ^ .\tmp_build\Comfy3D_Pre_Builds +git clone --depth=1 https://ghp.ci/https://github.com/autonomousvision/mip-splatting.git ^ + .\tmp_build\mip-splatting + .\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ .\tmp_build\Comfy3D_Pre_Builds\_Libs\pointnet2_ops @@ -55,7 +58,14 @@ git clone --depth=1 https://ghp.ci/https://github.com/MrForExample/Comfy3D_Pre_B .\tmp_build\Comfy3D_Pre_Builds\_Libs\vox2seq .\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ - git+https://ghp.ci/https://github.com/ashawkey/diff-gaussian-rasterization.git + .\tmp_build\mip-splatting\submodules\diff-gaussian-rasterization + +@REM PIP 会自动 git clone --recurse-submodules ,无需手动克隆 +.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ + git+https://ghp.ci/https://github.com/JeffreyXiang/diffoctreerast.git + +.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ + git+https://ghp.ci/https://github.com/EasternJournalist/utils3d.git .\python_embeded\python.exe -s -m pip wheel -w tmp_build ^ git+https://ghp.ci/https://github.com/ashawkey/kiuikit.git @@ -72,4 +82,17 @@ del .\tmp_build\numpy-2*.whl for %%i in (.\tmp_build\*.whl) do .\python_embeded\python.exe -s -m pip install --force-reinstall "%%i" +@REM =========================================================================== + +@REM (可选,默认关闭) Flash Attention, 用于 TRELLIS demo 等 +@REM "flash-attn" 只能用于 Ampere (RTX 30 系 / A100) 及更新的 GPU。 +@REM 注意:编译耗时很长! + +@REM MAX_JOBS 含义:限制 Ninja 并行数,避免内存溢出。如果 RAM 大于 96GB,无需限制 +rem set MAX_JOBS=4 + +rem .\python_embeded\python.exe -s -m pip install flash-attn --no-build-isolation + +@REM =========================================================================== + .\python_embeded\python.exe -s -m pip install numpy==1.26.4 diff --git a/pt25-cu124/generate-requirements5.sh b/pt25-cu124/generate-requirements5.sh index b847bcd..82f2ed8 100644 --- a/pt25-cu124/generate-requirements5.sh +++ b/pt25-cu124/generate-requirements5.sh @@ -5,7 +5,7 @@ echo '#' > requirements5.txt array=( https://github.com/comfyanonymous/ComfyUI/raw/refs/tags/v0.3.7/requirements.txt -https://github.com/MrForExample/ComfyUI-3D-Pack/raw/0880fa8d2945b8abb990ad768e0cfe704e0d025e/requirements.txt +https://github.com/MrForExample/ComfyUI-3D-Pack/raw/a35a737676cf3cbb23360d98032870e242dae199/requirements.txt https://github.com/kijai/ComfyUI-KJNodes/raw/refs/heads/main/requirements.txt https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite/raw/refs/heads/main/requirements.txt https://github.com/ltdrdata/ComfyUI-Impact-Pack/raw/refs/heads/Main/requirements.txt diff --git a/pt25-cu124/requirements8.txt b/pt25-cu124/requirements8.txt index babb8a1..3aa3a68 100644 --- a/pt25-cu124/requirements8.txt +++ b/pt25-cu124/requirements8.txt @@ -1,4 +1 @@ -# 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 +https://huggingface.co/lldacing/flash-attention-windows-wheel/resolve/main/flash_attn-2.7.0.post2%2Bcu124torch2.5.1cxx11abiFALSE-cp312-cp312-win_amd64.whl diff --git a/pt25-cu124/requirements9.txt b/pt25-cu124/requirements9.txt index 5049288..babb8a1 100644 --- a/pt25-cu124/requirements9.txt +++ b/pt25-cu124/requirements9.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/requirementsA.txt b/pt25-cu124/requirementsA.txt index 6749d0e..5049288 100644 --- a/pt25-cu124/requirementsA.txt +++ b/pt25-cu124/requirementsA.txt @@ -1,12 +1,2 @@ -# Make sure use Numpy 1 -numpy==1.26.4 - -# ComfyUI-Manager's dep "matrix-client" is outdated, -# and should be replaced by matrix-nio. -# Ref: https://pypi.org/project/matrix-client/ -# Here I just choose not install it. It's a client for Matrix.org. -#matrix-client==0.4.0 - -# For TRELLIS demo -gradio==4.44.1 -gradio_litmodel3d==0.0.1 +--find-links https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.5.1_cu124.html +kaolin diff --git a/pt25-cu124/requirementsB.txt b/pt25-cu124/requirementsB.txt new file mode 100644 index 0000000..6749d0e --- /dev/null +++ b/pt25-cu124/requirementsB.txt @@ -0,0 +1,12 @@ +# Make sure use Numpy 1 +numpy==1.26.4 + +# ComfyUI-Manager's dep "matrix-client" is outdated, +# and should be replaced by matrix-nio. +# Ref: https://pypi.org/project/matrix-client/ +# Here I just choose not install it. It's a client for Matrix.org. +#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 478fd66..680de38 100644 --- a/pt25-cu124/stage1.sh +++ b/pt25-cu124/stage1.sh @@ -21,11 +21,11 @@ unzip -q python_embeded.zip -d "$workdir"/python_embeded # Download 3D-Pack # Note: zip archive doesn't contain the ".git" folder, it's not upgradable. cd "$workdir" -curl -sSL https://github.com/MrForExample/ComfyUI-3D-Pack/archive/0880fa8d2945b8abb990ad768e0cfe704e0d025e.zip \ - -o ComfyUI-3D-Pack-0880fa8d2945b8abb990ad768e0cfe704e0d025e.zip -unzip -q ComfyUI-3D-Pack-0880fa8d2945b8abb990ad768e0cfe704e0d025e.zip -mv ComfyUI-3D-Pack-0880fa8d2945b8abb990ad768e0cfe704e0d025e ComfyUI-3D-Pack -rm ComfyUI-3D-Pack-0880fa8d2945b8abb990ad768e0cfe704e0d025e.zip +curl -sSL https://github.com/MrForExample/ComfyUI-3D-Pack/archive/a35a737676cf3cbb23360d98032870e242dae199.zip \ + -o ComfyUI-3D-Pack-a35a737676cf3cbb23360d98032870e242dae199.zip +unzip -q ComfyUI-3D-Pack-a35a737676cf3cbb23360d98032870e242dae199.zip +mv ComfyUI-3D-Pack-a35a737676cf3cbb23360d98032870e242dae199 ComfyUI-3D-Pack +rm ComfyUI-3D-Pack-a35a737676cf3cbb23360d98032870e242dae199.zip cd "$workdir" curl -sSL https://github.com/MrForExample/Comfy3D_Pre_Builds/archive/ac9f238f092b94ba319ce06f3ccd80b9d0f6c8c4.zip \ @@ -65,6 +65,7 @@ $pip_exe install "$workdir"/Comfy3D_Pre_Builds/_Build_Wheels/_Wheels_win_py312_t $pip_exe install -r "$workdir"/requirements8.txt $pip_exe install -r "$workdir"/requirements9.txt $pip_exe install -r "$workdir"/requirementsA.txt +$pip_exe install -r "$workdir"/requirementsB.txt # Add Ninja binary (replacing PIP Ninja) ## The 'python_embeded\Scripts\ninja.exe' is not working, @@ -87,8 +88,8 @@ rm aria2.zip # Setup Python embeded, part 3/3 cd "$workdir"/python_embeded +sed -i '1i../TRELLIS' ./python312._pth sed -i '1i../ComfyUI' ./python312._pth - $pip_exe list cd "$workdir" diff --git a/pt25-cu124/stage2.sh b/pt25-cu124/stage2.sh index 5b9e5bd..a86af40 100644 --- a/pt25-cu124/stage2.sh +++ b/pt25-cu124/stage2.sh @@ -9,12 +9,16 @@ export PATH="$PATH:$workdir/Comfy3D_WinPortable/python_embeded/Scripts" ls -lahF -mkdir -p "$workdir"/Comfy3D_WinPortable -mv python_embeded Comfy3D_WinPortable/python_embeded +mkdir -p "$workdir"/Comfy3D_WinPortable/extras + +mv "$workdir"/python_embeded "$workdir"/Comfy3D_WinPortable/python_embeded # Redirect HuggingFace-Hub model folder export HF_HUB_CACHE="$workdir/Comfy3D_WinPortable/HuggingFaceHub" mkdir -p "${HF_HUB_CACHE}" +# Redirect Pytorch Hub model folder +export TORCH_HOME="$workdir/Comfy3D_WinPortable/TorchHome" +mkdir -p "${TORCH_HOME}" # ComfyUI main app (latest) git clone https://github.com/comfyanonymous/ComfyUI.git \ @@ -59,12 +63,11 @@ cd "$workdir"/Comfy3D_WinPortable/ComfyUI/custom_nodes/ComfyUI-Impact-Subpack cd "$workdir"/Comfy3D_WinPortable ./python_embeded/python.exe -s -B ComfyUI/main.py --quick-test-for-ci --cpu +################################################################################ # Download extra models # u2net model needed by rembg (to avoid download at first start) -cd "$workdir"/Comfy3D_WinPortable -mkdir extras curl -sSL https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx \ - -o ./extras/u2net.onnx + -o "$workdir"/Comfy3D_WinPortable/extras/u2net.onnx # RealESRGAN_x4plus needed by example workflows curl -sSL https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth \ @@ -81,25 +84,20 @@ rm -rf "$workdir"/Comfy3D_WinPortable/ComfyUI/user/default/workflows/_Example_Ou mv "$workdir"/Comfy3D_WinPortable/ComfyUI/custom_nodes/ComfyUI-3D-Pack/_Example_Workflows/_Example_Inputs_Files/* \ "$workdir"/Comfy3D_WinPortable/ComfyUI/input/ -# Move source files needed by user compile-install -mv "$workdir"/Comfy3D_Pre_Builds/_Libs/* "$workdir"/Comfy3D_WinPortable/extras/ - -# Download more dep source +################################################################################ +# Source files needed by user compile-install cd "$workdir"/Comfy3D_WinPortable/extras/ +mv "$workdir"/Comfy3D_Pre_Builds/_Libs/* "$workdir"/Comfy3D_WinPortable/extras/ + +# PyTorch3D curl -sSL https://github.com/facebookresearch/pytorch3d/archive/refs/heads/main.zip \ -o temp.zip unzip -q temp.zip mv pytorch3d-main pytorch3d rm temp.zip -# Dep source for TRELLIS -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 - +# Differential Octree Rasterization $gcs https://github.com/JeffreyXiang/diffoctreerast.git # Yet another diff-gaussian-rasterization (this version is used by TRELLIS) @@ -115,6 +113,7 @@ cp -rf "$workdir"/attachments/* \ "$workdir"/Comfy3D_WinPortable/ # Clean up +rm -v "$workdir"/Comfy3D_WinPortable/*.log cd "$workdir"/Comfy3D_WinPortable/ComfyUI/custom_nodes rm ./was-node-suite-comfyui/was_suite_config.json