Skip to content

Commit

Permalink
add 'pt24-cu121'
Browse files Browse the repository at this point in the history
  • Loading branch information
YanWenKun committed Dec 7, 2024
1 parent 074b4c4 commit 4a35a8f
Show file tree
Hide file tree
Showing 18 changed files with 653 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build-pt24-cu121.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Build & Upload pt24-cu121 Package"

on:
workflow_dispatch:

jobs:
build_upload:
permissions:
contents: "write"
packages: "write"
pull-requests: "read"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Stage 1 Gathering Dependencies
shell: bash
working-directory: pt24-cu121
run: bash stage1.sh

- name: Stage 2 Assembling Repositories
shell: bash
working-directory: pt24-cu121
run: bash stage2.sh

- name: Stage 3 Compressing Package
shell: bash
working-directory: pt24-cu121
run: bash stage3.sh

- name: Upload archive to release
uses: xresloader/upload-to-github-release@v1
env:
# You don't need to configure this token. It'll be auto-set when GitHub Actions start.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "pt24-cu121/Comfy3D_WinPortable.7z*"
# Always draft before release.
draft: true
overwrite: true
30 changes: 30 additions & 0 deletions pt24-cu121/attachments/force-update-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# You need to install Git for Windows and select Git Bash (Default)
# https://git-scm.com/download/win

set -eu

# If you don't want a FORCE update, remove "git reset" line
function git_pull () {
git_remote_url=$(git -C "$1" remote get-url origin) ;

if [[ $git_remote_url =~ ^(https:\/\/github\.com\/)(.*)(\.git)$ ]]; then
echo "Updating: $1" ;
git -C "$1" reset --hard ;
git -C "$1" pull --ff-only ;
echo "Done Updating: $1" ;
fi ;
}

git_pull ComfyUI

cd ./ComfyUI/custom_nodes
for D in *; do
if [ -d "${D}" ]; then
git_pull "${D}" &
fi
done

wait $(jobs -p)

exit 0
60 changes: 60 additions & 0 deletions pt24-cu121/attachments/reinstall-deps-for-3d.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@echo off
echo ################################################################################
echo In case you have trouble running 3D-Pack workflow, especially get error from
echo diff_gaussian_rasterization, or just unknown CUDA error:
echo This script is a backup resort, it will attempt to download and build several
echo dependencies for 3D-Pack from GitHub, and will perform an overwrite installation
echo after compiling all the wheel files.
echo It will install packages to local python_embeded folder,and will not affect
echo your Windows OS.
echo If the task is interrupted before the compilation is complete, it will not
echo affect the existing python_embeded.
echo Regardless of success or failure, the temporary files will not be deleted.
echo ################################################################################
echo Require environment: C++ Build Tools (Visual Studio 2022), CUDA Toolkit, Git.
echo Recommend to edit TORCH_CUDA_ARCH_LIST in this script to save build time.
echo ################################################################################
echo Press Enter to continue...

pause

@echo on

@REM In order 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

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

git clone --depth=1 https://github.com/MrForExample/Comfy3D_Pre_Builds.git ^
.\tmp_build\Comfy3D_Pre_Builds

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
.\tmp_build\Comfy3D_Pre_Builds\_Libs\pointnet2_ops

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
.\tmp_build\Comfy3D_Pre_Builds\_Libs\simple-knn

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
git+https://github.com/ashawkey/diff-gaussian-rasterization.git

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
git+https://github.com/ashawkey/kiuikit.git

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
git+https://github.com/NVlabs/nvdiffrast.git

echo Build complete, installing...

del .\tmp_build\numpy-2*.whl

for %i in (.\tmp_build\*.whl) do .\python_embeded\python.exe -s -m pip install --force-reinstall "%i"

.\python_embeded\python.exe -s -m pip install numpy==1.26.4
41 changes: 41 additions & 0 deletions pt24-cu121/attachments/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@REM To set proxy, edit and uncomment the two lines below (remove 'rem ' in the beginning of line).
rem set HTTP_PROXY=http://localhost:1081
rem set HTTPS_PROXY=http://localhost:1081

@REM To set mirror site for PIP & HuggingFace Hub, uncomment and edit the two lines below.
rem set PIP_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
rem set HF_ENDPOINT=https://hf-mirror.com

@REM To set HuggingFace Access Token, uncomment and edit the line below.
@REM https://huggingface.co/settings/tokens
rem set HF_TOKEN=

@REM To enable HuggingFace Hub's experimental high-speed file transfer, uncomment the line below.
@REM https://huggingface.co/docs/huggingface_hub/hf_transfer
rem set HF_HUB_ENABLE_HF_TRANSFER=1

@REM In order to save your time on compiling PyTorch JIT CPP extensions, edit this line according to your GPU arch.
@REM Ref: https://github.com/ashawkey/stable-dreamfusion/issues/360#issuecomment-2292510049
set TORCH_CUDA_ARCH_LIST=5.2+PTX;6.0;6.1+PTX;7.5;8.0;8.6;8.9+PTX

@REM This command redirects HuggingFace-Hub to download model files in this folder.
set HF_HUB_CACHE=%~dp0\HuggingFaceHub

@REM This command will set PATH environment variable.
set PATH=%PATH%;%~dp0\python_embeded\Scripts

@REM This command will let the .pyc files to be stored in one place.
set PYTHONPYCACHEPREFIX=%~dp0\pycache

@REM This command will copy u2net.onnx to user's home path, to skip download at first start.
IF NOT EXIST "%USERPROFILE%\.u2net\u2net.onnx" (
IF EXIST ".\extras\u2net.onnx" (
mkdir "%USERPROFILE%\.u2net" 2>nul
copy ".\extras\u2net.onnx" "%USERPROFILE%\.u2net\u2net.onnx"
)
)

@REM If you don't want the browser to open automatically, add " --disable-auto-launch" (without quotation marks) to the end of the line below.
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build

pause
51 changes: 51 additions & 0 deletions pt24-cu121/attachments/中文脚本/run_cn.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@REM 依照下表,修改为你的 GPU 对应架构,以节约运行时编译 PyTorch C++ 扩展的时间:
@REM 'Pascal', '6.0;6.1+PTX'
@REM 'Volta+Tegra', '7.2'
@REM 'Volta', '7.0+PTX'
@REM 'Turing', '7.5+PTX'
@REM 'Ampere+Tegra', '8.7'
@REM 'Ampere', '8.0;8.6+PTX'
@REM 'Ada', '8.9+PTX'
@REM 'Hopper', '9.0+PTX'
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

@REM 如需配置 HuggingFace Access Token(访问令牌),取消注释并编辑。
@REM 管理令牌: https://huggingface.co/settings/tokens
rem set HF_TOKEN=

@REM 如需启用 HF Hub 实验性高速传输,取消该行注释。仅在千兆比特以上网速有意义。
@REM https://huggingface.co/docs/huggingface_hub/hf_transfer
rem set HF_HUB_ENABLE_HF_TRANSFER=1

@REM 该环境变量配置 PIP 使用国内镜像站点。
set PIP_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

@REM 该环境变量配置 HuggingFace Hub 使用国内镜像站点。
set HF_ENDPOINT=https://hf-mirror.com

@REM 该环境变量指示 HuggingFace Hub 下载模型到"本目录\HuggingFaceHub",而不是"用户\.cache"目录。
set HF_HUB_CACHE=%~dp0\HuggingFaceHub

@REM 该命令配置 PATH 环境变量。
set PATH=%PATH%;%~dp0\python_embeded\Scripts

@REM 该环境变量使 .pyc 缓存文件集中保存在一个文件夹下,而不是随 .py 文件分布。
set PYTHONPYCACHEPREFIX=%~dp0\pycache

@REM 该命令会复制 u2net.onnx 到用户主目录下,以免启动时还需下载。
IF NOT EXIST "%USERPROFILE%\.u2net\u2net.onnx" (
IF EXIST ".\extras\u2net.onnx" (
mkdir "%USERPROFILE%\.u2net" 2>nul
copy ".\extras\u2net.onnx" "%USERPROFILE%\.u2net\u2net.onnx"
)
)

@REM 如不希望 ComfyUI 启动后自动打开浏览器,添加 --disable-auto-launch 到下行末尾(注意空格)。
@REM 如在用 40 系显卡,可添加 --fast 开启实验性高性能模式。
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build

pause
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# 注意:Windows 下运行需要安装 Git 并在安装时选择 Git Bash(默认)

set -eu

# 如果希望“尝试更新但不强制”,删除 git reset 行以避免还原本地变更
function change_url_or_pull () {
git_remote_url=$(git -C "$1" remote get-url origin) ;

if [[ $git_remote_url =~ ^(https:\/\/ghp\.ci\/)(.*)(\.git)$ ]]; then
echo "正在更新: $1" ;
git -C "$1" reset --hard ;
git -C "$1" pull --ff-only ;
echo "更新完成: $1" ;
elif [[ $git_remote_url =~ ^(https:\/\/github\.com\/)(.*)(\.git)$ ]]; then
echo "正在修改URL并更新: $1" ;
git -C "$1" reset --hard ;
git -C "$1" remote set-url origin "https://ghp.ci/$git_remote_url" ;
git -C "$1" pull --ff-only ;
echo "更新完成: $1" ;
fi ;
}

change_url_or_pull ComfyUI

# 这里使用 & 将任务置入后台,以实现多线程,并等待全部任务完成
cd ./ComfyUI/custom_nodes
for D in *; do
if [ -d "${D}" ]; then
change_url_or_pull "${D}" &
fi
done

wait $(jobs -p)

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
chcp 65001

@echo off

echo ################################################################################
echo "如果遇到 3D-Pack 疑难问题(执行工作流时 C++ 报错、CUDA 报错等,"
echo "尤其是 diff_gaussian_rasterization 抛出异常),可以尝试本脚本。"
echo "本脚本会从 GitHub 下载 3D-Pack 的若干依赖项,"
echo "并全部编译完后,再使用 wheel 文件进行覆盖安装。"
echo ################################################################################
echo "运行需要环境: C++ 编译套件 (VS 2022), CUDA 工具包, Git。"
echo "建议修改脚本中的 TORCH_CUDA_ARCH_LIST 以大幅节约编译时间。"
echo ################################################################################
echo "安装不会影响你的 Windows 系统,只影响 python_embeded 目录。"
echo "如在编译期间中断任务,不会影响 python_embeded 。"
echo "无论执行成功与否,临时文件均会被保留。"
echo ################################################################################
echo "按回车继续……"

pause

@echo on

@REM 如需配置代理,编辑下两行命令,并取消注释(移除行首的 'rem ')。
rem set HTTP_PROXY=http://localhost:1081
rem set HTTPS_PROXY=http://localhost:1081

@REM 配置 PIP 与 HuggingFace Hub 镜像
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 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

git clone --depth=1 https://ghp.ci/https://github.com/MrForExample/Comfy3D_Pre_Builds.git ^
.\tmp_build\Comfy3D_Pre_Builds

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
.\tmp_build\Comfy3D_Pre_Builds\_Libs\pointnet2_ops

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
.\tmp_build\Comfy3D_Pre_Builds\_Libs\simple-knn

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
git+https://ghp.ci/https://github.com/ashawkey/diff-gaussian-rasterization.git

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
git+https://ghp.ci/https://github.com/ashawkey/kiuikit.git

.\python_embeded\python.exe -s -m pip wheel -w tmp_build ^
git+https://ghp.ci/https://github.com/NVlabs/nvdiffrast.git

echo "编译完成,开始安装……"

del .\tmp_build\numpy-2*.whl

for %i in (.\tmp_build\*.whl) do .\python_embeded\python.exe -s -m pip install --force-reinstall "%i"

.\python_embeded\python.exe -s -m pip install numpy==1.26.4
30 changes: 30 additions & 0 deletions pt24-cu121/generate-requirements5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -eu

array=(
https://github.com/comfyanonymous/ComfyUI/raw/refs/tags/v0.0.1/requirements.txt
https://github.com/MrForExample/ComfyUI-3D-Pack/raw/bdc5e3029ed96d9fa25e651e12fce1553a4422c4/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
https://github.com/ltdrdata/ComfyUI-Impact-Subpack/raw/refs/heads/main/requirements.txt
https://github.com/ltdrdata/ComfyUI-Inspire-Pack/raw/refs/heads/main/requirements.txt
https://github.com/WASasquatch/was-node-suite-comfyui/raw/refs/heads/main/requirements.txt
https://github.com/edenartlab/eden_comfy_pipelines/raw/refs/heads/main/requirements.txt
)

for line in "${array[@]}";
do curl -w "\n" -sSL "${line}" >> requirements5.txt
done

sed -i '/^#/d' requirements5.txt
sed -i 's/[[:space:]]*$//' requirements5.txt
sed -i 's/>=.*$//' requirements5.txt
sed -i 's/_/-/g' requirements5.txt

# Remove duplicate items, compare to requirements4.txt
grep -Fixv -f requirements4.txt requirements5.txt > temp.txt && mv temp.txt requirements5.txt

sort -uo requirements5.txt requirements5.txt

echo "<requirements5.txt> generated. Check before use."
2 changes: 2 additions & 0 deletions pt24-cu121/requirements2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cython
cmake
6 changes: 6 additions & 0 deletions pt24-cu121/requirements3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--index-url https://download.pytorch.org/whl/cu121
--extra-index-url https://pypi.org/simple
xformers==0.0.27.post2
torch==2.4.0
torchvision==0.19.0
torchaudio
Loading

0 comments on commit 4a35a8f

Please sign in to comment.