Skip to content

Commit d1ff44e

Browse files
author
宣源
committed
merge main
2 parents 2598e5f + 13b6d07 commit d1ff44e

File tree

159 files changed

+38334
-7328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+38334
-7328
lines changed

.github/ISSUE_TEMPLATE/1-bug-report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ body:
88
attributes:
99
label: Checklist
1010
options:
11-
- label: 1. I have searched for related issues and FAQs (https://github.com/mit-han-lab/nunchaku/blob/main/docs/faq.md) but was unable to find a solution.
11+
- label: 1. I have searched for related issues and FAQs (https://github.com/nunchaku-tech/nunchaku/blob/main/docs/faq.md) but was unable to find a solution.
1212
- label: 2. The issue persists in the latest version.
1313
- label: 3. Please note that without environment information and a minimal reproducible example, it will be difficult for us to reproduce and address the issue, which may delay our response.
14-
- label: 4. If your report is a question rather than a bug, please submit it as a discussion at https://github.com/mit-han-lab/ComfyUI-nunchaku/discussions/new/choose. Otherwise, this issue will be closed.
14+
- label: 4. If your report is a question rather than a bug, please submit it as a discussion at https://github.com/nunchaku-tech/ComfyUI-nunchaku/discussions/new/choose. Otherwise, this issue will be closed.
1515
- label: 5. I will do my best to describe the issue in English.
1616
- type: textarea
1717
attributes:

.github/ISSUE_TEMPLATE/2-feature-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ body:
77
attributes:
88
label: Checklist
99
options:
10-
- label: 1. If the issue you raised is not a feature but a question, please raise a discussion at https://github.com/mit-han-lab/ComfyUI-nunchaku/discussions/new/choose. Otherwise, it will be closed.
10+
- label: 1. If the issue you raised is not a feature but a question, please raise a discussion at https://github.com/nunchaku-tech/ComfyUI-nunchaku/discussions/new/choose. Otherwise, it will be closed.
1111
- label: 2. I will do my best to describe the issue in English.
1212
- type: textarea
1313
attributes:

.github/pull_request_template.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!-- Thank you for your contribution—we truly appreciate it! To help us review your pull request efficiently, please follow the guidelines below. If anything is unclear, feel free to open the PR and ask for clarification. You can also refer to our [contribution guide](https://nunchaku.tech/docs/ComfyUI-nunchaku/developer/contribution_guide.html) for more details. -->
2+
3+
## Motivation
4+
5+
<!-- Explain the purpose of this PR and the goals it aims to achieve. -->
6+
7+
## Modifications
8+
9+
<!-- Describe the changes made in this PR. -->
10+
11+
## Checklist
12+
13+
- [ ] Code is formatted using Pre-Commit hooks (run `pre-commit run --all-files`).
14+
- [ ] Relevant unit tests are added in the [`tests/workflows`](../tests/workflows) directory following the guidance in the [Contribution Guide](https://nunchaku.tech/docs/comfyui-nunchaku/developer/contribution_guide.html).
15+
- [ ] Reference images are uploaded to PR comments and URLs are added to `test_cases.json`.
16+
- [ ] Additional test data (if needed) is registered in [`test_data/inputs.yaml`](../test_data/inputs.yaml).
17+
- [ ] Additional models (if needed) are registered in [`scripts/download_models.py`](../scripts/download_models.py) and [`test_data/models.yaml`](../test_data/models.yaml).
18+
- [ ] Additional custom nodes (if needed) are added to [`.github/workflows/pr-test.yaml`](../.github/workflows/pr-test.yaml).
19+
- [ ] **For reviewers:** If you're only helping merge the main branch and haven't contributed code to this PR, please remove yourself as a co-author when merging.
20+
- [ ] Please feel free to join our [Discord](https://discord.gg/Wk6PnwX9Sm) or [WeChat](https://huggingface.co/datasets/nunchaku-tech/cdn/blob/main/nunchaku/assets/wechat.jpg) to discuss your PR.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Build ComfyUI Desktop
2+
on:
3+
workflow_dispatch:
4+
repository_dispatch:
5+
types: [build-desktop]
6+
permissions:
7+
contents: write
8+
jobs:
9+
build-windows:
10+
name: Build ComfyUI Desktop - PyTorch ${{ matrix.pytorch_version }}
11+
runs-on: windows-latest
12+
strategy:
13+
max-parallel: 1
14+
matrix:
15+
pytorch_version: ['2.7', '2.8', '2.9']
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event.client_payload.ref || github.ref }}
21+
if: success()
22+
- name: Show latest commit
23+
run: git log -1 --oneline
24+
shell: bash
25+
- name: Setup Python 3.12
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.12'
29+
if: success()
30+
- name: Setup Node.js 20.18.0
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '20.18.0'
34+
if: success()
35+
- name: Extract version from pyproject.toml
36+
id: get_version
37+
run: |
38+
$VERSION = (Get-Content pyproject.toml | Select-String '^version = "(.+)"').Matches.Groups[1].Value
39+
echo "version=$VERSION" >> $env:GITHUB_OUTPUT
40+
echo "Extracted ComfyUI-nunchaku version: $VERSION"
41+
shell: pwsh
42+
if: success()
43+
- name: Get latest nunchaku release version
44+
id: get_nunchaku_version
45+
run: |
46+
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/nunchaku-tech/nunchaku/releases/latest" -Headers @{ "Authorization" = "Bearer $env:GITHUB_TOKEN"; "User-Agent" = "GitHub Actions" }
47+
$NUNCHAKU_VERSION = $response.tag_name -replace '^v', ''
48+
echo "nunchaku_version=$NUNCHAKU_VERSION" >> $env:GITHUB_OUTPUT
49+
echo "Latest nunchaku release: $NUNCHAKU_VERSION"
50+
shell: pwsh
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
if: success()
54+
- name: Run build script
55+
run: |
56+
cd ..
57+
ComfyUI-nunchaku\.github\workflows\build_comfyui_desktop.cmd
58+
shell: cmd
59+
env:
60+
NUNCHAKU_VERSION: ${{ steps.get_nunchaku_version.outputs.nunchaku_version }}
61+
TORCH_VERSION: ${{ matrix.pytorch_version }}
62+
if: success()
63+
- name: List build output
64+
run: |
65+
Get-ChildItem -Path "..\desktop\dist" -ErrorAction SilentlyContinue | Format-Table Name, Length, LastWriteTime
66+
shell: pwsh
67+
if: success()
68+
- name: Copy and rename artifacts
69+
run: |
70+
dir ..\desktop\dist
71+
mkdir artifacts
72+
for %%f in (..\desktop\dist\*.zip) do (
73+
echo Renaming %%~nxf to ComfyUI-nunchaku-${{ steps.get_version.outputs.version }}-torch${{ matrix.pytorch_version }}-desktop-win.zip
74+
move "%%f" "artifacts\ComfyUI-nunchaku-${{ steps.get_version.outputs.version }}-torch${{ matrix.pytorch_version }}-desktop-win.zip"
75+
)
76+
for %%f in (..\desktop\dist\*.exe) do (
77+
echo Renaming %%~nxf to ComfyUI-nunchaku-${{ steps.get_version.outputs.version }}-torch${{ matrix.pytorch_version }}-desktop-win.exe
78+
move "%%f" "artifacts\ComfyUI-nunchaku-${{ steps.get_version.outputs.version }}-torch${{ matrix.pytorch_version }}-desktop-win.exe"
79+
)
80+
dir artifacts
81+
shell: cmd
82+
if: success()
83+
- name: Upload build artifacts
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: ComfyUI-nunchaku-${{ steps.get_version.outputs.version }}-torch${{ matrix.pytorch_version }}-desktop-win.zip
87+
path: artifacts/*.zip
88+
retention-days: 7
89+
if: success()
90+
- name: Upload Artifact to Existing Release
91+
uses: softprops/action-gh-release@v1
92+
with:
93+
tag_name: v${{ steps.get_version.outputs.version }}
94+
files: artifacts/*.zip
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
if: success()
98+
- name: Clean up
99+
run: |
100+
cd ..
101+
rm -rf desktop
102+
shell: cmd
103+
if: always()

.github/workflows/build-docs.yaml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,27 @@ jobs:
3333
source $(conda info --base)/etc/profile.d/conda.sh
3434
conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; }
3535
which python
36-
conda install -c conda-forge gxx=11 gcc=11
36+
conda install -c conda-forge gxx=11 gcc=11 libsndfile -y
37+
pip install uv
3738
echo "Installing dependencies"
3839
cd ..
3940
git clone https://github.com/nunchaku-tech/nunchaku.git
4041
cd nunchaku
4142
git log -1 --oneline
4243
git submodule init
4344
git submodule update
44-
pip install -e ".[dev,docs]"
45+
uv pip install -e ".[dev,docs]"
4546
- name: Install ComfyUI
4647
run: |
4748
source $(conda info --base)/etc/profile.d/conda.sh
4849
conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; }
4950
which python
50-
pwd
51-
cd ..
52-
ln -s ComfyUI-nunchaku comfyui_nunchaku
53-
pip install comfy-cli
54-
yes | comfy --here install --nvidia --skip-torch-or-directml --version 0.3.60
55-
cd ComfyUI
56-
cd custom_nodes
57-
ln -s ../../ComfyUI-nunchaku
58-
pip install -r ComfyUI-nunchaku/requirements.txt
51+
uv pip install -e ".[dev,docs]"
5952
- name: Build docs
6053
run: |
6154
source $(conda info --base)/etc/profile.d/conda.sh
6255
conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; }
6356
which python
64-
pip install sphinx sphinx-tabs myst-parser sphinx-copybutton breathe sphinxcontrib-mermaid nbsphinx jupyter ipykernel graphviz sphinxext-rediraffe
65-
pip install furo sphinxawesome-theme sphinx-book-theme sphinx-rtd-theme
6657
cd docs
6758
make html
6859
- name: Deploy docs
@@ -80,5 +71,4 @@ jobs:
8071
if: always()
8172
run: |
8273
cd ..
83-
rm -rf nunchaku ComfyUI
84-
rm comfyui_nunchaku
74+
rm -rf nunchaku
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
@echo off
2+
setlocal
3+
4+
REM ==============================
5+
REM ComfyUI Desktop Build Script
6+
REM ==============================
7+
8+
REM Use environment variables if set, otherwise use defaults
9+
if not defined TORCH_VERSION set TORCH_VERSION=2.7
10+
if not defined NUNCHAKU_VERSION set NUNCHAKU_VERSION=1.0.0
11+
12+
echo Using TORCH_VERSION=%TORCH_VERSION%
13+
echo Using NUNCHAKU_VERSION=%NUNCHAKU_VERSION%
14+
15+
REM Set version-specific defaults, which is the desktop Python version
16+
set PYTHON_VERSION=3.12
17+
REM Node.js version must be complete version string instead of 20 or 20.19
18+
set NODE_VERSION=20.18.0
19+
set YARN_VERSION=4.5.0
20+
set CUDA_PIP_INDEX=cu128
21+
22+
REM Set torchaudio and torchvision versions based on TORCH_VERSION
23+
if "%TORCH_VERSION%"=="2.7" (
24+
set TORCHAUDIO_VERSION=2.7
25+
set TORCHVISION_VERSION=0.22
26+
) else if "%TORCH_VERSION%"=="2.8" (
27+
set TORCHAUDIO_VERSION=2.8
28+
set TORCHVISION_VERSION=0.23
29+
) else if "%TORCH_VERSION%"=="2.9" (
30+
set TORCHAUDIO_VERSION=2.9
31+
set TORCHVISION_VERSION=0.24
32+
) else (
33+
echo Warning: Unknown TORCH_VERSION=%TORCH_VERSION%, using default versions
34+
set TORCHAUDIO_VERSION=%TORCH_VERSION%
35+
set TORCHVISION_VERSION=0.22
36+
)
37+
38+
set PYTHON_VERSION_STR=%PYTHON_VERSION:.=%
39+
40+
REM 1. Install uv package
41+
echo Installing uv package...
42+
python -m pip install --upgrade pip || (
43+
echo ERROR: Failed to upgrade pip
44+
exit /b 1
45+
)
46+
python -m pip install uv || (
47+
echo ERROR: Failed to install uv
48+
exit /b 1
49+
)
50+
51+
REM 2. Clone ComfyUI desktop repo
52+
echo Cloning ComfyUI Desktop...
53+
git clone https://github.com/nunchaku-tech/desktop.git || (
54+
echo ERROR: Failed to clone desktop repository
55+
exit /b 1
56+
)
57+
cd desktop || (
58+
echo ERROR: Failed to enter desktop directory
59+
exit /b 1
60+
)
61+
git checkout ComfyUI-nunchaku-1.0.2 || (
62+
echo ERROR: Failed to checkout dev branch
63+
exit /b 1
64+
)
65+
git log -1 --oneline
66+
67+
REM 3. Install Yarn using corepack
68+
echo Installing yarn...
69+
call corepack enable || (
70+
echo ERROR: Failed to enable corepack
71+
exit /b 1
72+
)
73+
call corepack prepare yarn@%YARN_VERSION% --activate || (
74+
echo ERROR: Failed to prepare yarn
75+
exit /b 1
76+
)
77+
78+
REM 4. Install node modules and rebuild electron
79+
echo Rebuilding native modules...
80+
call yarn install || (
81+
echo ERROR: Failed to run yarn install
82+
exit /b 1
83+
)
84+
call npx --yes electron-rebuild || (
85+
echo ERROR: Failed to rebuild electron
86+
exit /b 1
87+
)
88+
call yarn make:assets || (
89+
echo ERROR: Failed to make assets
90+
exit /b 1
91+
)
92+
93+
REM 5. Overwrite override.txt with torch version + custom nunchaku wheel
94+
echo Writing override.txt...
95+
96+
xcopy /E /I /Y /H ..\ComfyUI-nunchaku assets\ComfyUI\custom_nodes\ComfyUI-nunchaku || (
97+
echo ERROR: Failed to copy ComfyUI-nunchaku to assets
98+
exit /b 1
99+
)
100+
101+
set NUNCHAKU_URL=https://github.com/nunchaku-tech/nunchaku/releases/download/v%NUNCHAKU_VERSION%/nunchaku-%NUNCHAKU_VERSION%+torch%TORCH_VERSION%-cp%PYTHON_VERSION_STR%-cp%PYTHON_VERSION_STR%-win_amd64.whl
102+
103+
(
104+
echo torch==%TORCH_VERSION%+%CUDA_PIP_INDEX%
105+
echo torchaudio==%TORCHAUDIO_VERSION%+%CUDA_PIP_INDEX%
106+
echo torchvision==%TORCHVISION_VERSION%+%CUDA_PIP_INDEX%
107+
echo nunchaku @ %NUNCHAKU_URL%
108+
) > assets\override.txt
109+
echo nunchaku >> assets\ComfyUI\requirements.txt
110+
111+
REM 6. Build compiled requirements with uv
112+
echo Rebuilding requirements (windows_nvidia.compiled)...
113+
assets\uv\win\uv.exe pip compile assets\ComfyUI\requirements.txt ^
114+
assets\ComfyUI\custom_nodes\ComfyUI-Manager\requirements.txt ^
115+
assets\ComfyUI\custom_nodes\ComfyUI-nunchaku\requirements.txt ^
116+
--emit-index-annotation --emit-index-url --index-strategy unsafe-best-match ^
117+
-o assets\requirements\windows_nvidia.compiled ^
118+
--override assets\override.txt ^
119+
--index-url https://pypi.org/simple ^
120+
--extra-index-url https://download.pytorch.org/whl/%CUDA_PIP_INDEX% || (
121+
echo ERROR: Failed to compile requirements with uv
122+
exit /b 1
123+
)
124+
125+
REM 7. Build for NVIDIA users on Windows
126+
echo Building ComfyUI for NVIDIA...
127+
call yarn make:nvidia || (
128+
echo ERROR: Failed to build ComfyUI for NVIDIA
129+
exit /b 1
130+
)
131+
132+
echo ========================================
133+
echo ✅ Build process completed successfully!
134+
echo ========================================
135+
136+
endlocal

.github/workflows/pr-test.yaml

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,52 +58,39 @@ jobs:
5858
source $(conda info --base)/etc/profile.d/conda.sh
5959
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
6060
which python
61-
conda install -c conda-forge gxx=11 gcc=11
61+
conda install -c conda-forge gxx=11 gcc=11 libsndfile -y
62+
cd ..
6263
rm -rf nunchaku
6364
git clone --recurse-submodules https://github.com/nunchaku-tech/nunchaku.git
6465
cd nunchaku
65-
pip install torch==2.8 torchvision==0.23 --index-url https://download.pytorch.org/whl/cu128
66-
pip install -e ".[ci]"
67-
- name: Install ComfyUI
66+
pip install uv
67+
uv pip install torch==2.8 torchvision==0.23 --index-url https://download.pytorch.org/whl/cu128
68+
uv pip install -e ".[ci]"
69+
- name: Setup ComfyUI-Nunchaku
6870
run: |
6971
source $(conda info --base)/etc/profile.d/conda.sh
7072
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
7173
which python
74+
uv pip install --torch-backend=auto -e ".[ci]"
7275
pwd
7376
cd ..
74-
rm -rf ComfyUI
75-
mkdir -p ComfyUI
76-
cd ComfyUI
77+
rm -rf test-workspace
78+
mkdir -p test-workspace
79+
cd test-workspace
7780
mkdir -p "${COMFYUI_MODELS_ROOT}"
7881
ln -s "${COMFYUI_MODELS_ROOT}" models
79-
pip install -r ../ComfyUI-nunchaku/requirements.txt
8082
ln -s ../ComfyUI-nunchaku/tests tests
81-
pip install -r tests/requirements.txt
82-
mkdir -p custom_nodes
83-
cd custom_nodes
84-
ln -s ../../ComfyUI-nunchaku
85-
git clone https://github.com/Fannovel16/comfyui_controlnet_aux.git
86-
cd comfyui_controlnet_aux
87-
git checkout cc6b232
88-
cd ..
89-
git clone https://github.com/CY-CHENYUE/ComfyUI-InpaintEasy.git
90-
cd ComfyUI-InpaintEasy
91-
pip install -r requirements.txt
92-
git checkout d631a03
93-
cd ..
94-
cd ..
95-
python custom_nodes/ComfyUI-nunchaku/scripts/download_models.py
96-
mkdir -p input
97-
python custom_nodes/ComfyUI-nunchaku/scripts/download_inputs.py
83+
ln -s ../ComfyUI-nunchaku/test_data test_data
84+
python ../ComfyUI-nunchaku/scripts/setup_custom_nodes.py
9885
- name: Run tests
9986
run: |
10087
source $(conda info --base)/etc/profile.d/conda.sh
10188
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
10289
pwd
103-
cd ../ComfyUI
104-
pytest tests/test_workflows.py -x -vv --reruns 2 --reruns-delay 0
90+
cd ../test-workspace
91+
pytest tests/test_workflows.py -x -vv --reruns 4 --reruns-delay 0
10592
- name: clean up
10693
if: always()
10794
run: |
10895
cd ..
109-
rm -rf nunchaku ComfyUI
96+
rm -rf nunchaku test-workspace

0 commit comments

Comments
 (0)