"tests/benchmarks/bm_main.py" did not exist on "b19fe1de2fd39aa40c888a1cc02e45ed91a87851"
Unverified Commit 2bfd3ad9 authored by Muyang Li's avatar Muyang Li Committed by GitHub
Browse files

chore: add ComfyUI tests (#390)

* chore: add comfyui tests

* finished run ampere tests

* update the blackwell workflows

* install the comfyui test dependencies

* update the expected lpips

* better tests

* update an lpips
parent 67c543d7
......@@ -36,7 +36,6 @@ on:
# issue_comment:
# types: [ created ]
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
......@@ -58,7 +57,7 @@ jobs:
echo "should_run=false" >> $GITHUB_OUTPUT
fi
set-up-build-env:
run-tests:
runs-on: [ self-hosted, ampere ]
needs: [ check-comment ]
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
......@@ -75,7 +74,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
# ref: ${{ github.event.pull_request.head.sha || github.sha }}
ref: ${{ steps.set-ref.outputs.ref }}
submodules: true
......@@ -95,18 +93,10 @@ jobs:
which python
conda install -c conda-forge gxx=11 gcc=11
echo "Installing dependencies"
pip install torch torchvision torchaudio
pip install ninja wheel diffusers transformers accelerate sentencepiece protobuf huggingface_hub
build:
needs: set-up-build-env
runs-on: [ self-hosted, ampere ]
timeout-minutes: 30
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
pip install torch==2.7 torchvision==0.22 torchaudio==2.7 --index-url https://download.pytorch.org/whl/cu128
pip install ninja wheel diffusers==0.33.1 transformers==4.51 accelerate==1.7 sentencepiece==0.2 protobuf==6.31 huggingface_hub==0.31
steps:
- name: Run build tests
- name: Build
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
......@@ -114,47 +104,63 @@ jobs:
NUNCHAKU_INSTALL_MODE=ALL python setup.py develop
pip install -r tests/requirements.txt
test-flux-memory:
needs: build
runs-on: [ self-hosted, ampere ]
timeout-minutes: 30
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
steps:
- name: Run FLUX memory test
- name: Setup ComfyUI
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
pwd
cd ..
pip install comfy-cli
yes | comfy --here install --nvidia --skip-torch-or-directml --version 0.3.34
cd ComfyUI
rm -r models
mkdir -p ${{ secrets.COMFYUI_MODELS_ROOT_AMPERE }}
ln -s ${{ secrets.COMFYUI_MODELS_ROOT_AMPERE }} models
cd custom_nodes
git clone -b dev https://github.com/mit-han-lab/ComfyUI-nunchaku.git
cd ..
pip install -r custom_nodes/ComfyUI-nunchaku/requirements.txt
comfy node install comfyui_controlnet_aux
comfy node install comfyui-inpainteasy
cp -r custom_nodes/ComfyUI-nunchaku/tests nunchaku_tests
pip install -r nunchaku_tests/requirements.txt
HF_TOKEN=${{ secrets.HF_TOKEN }} python custom_nodes/ComfyUI-nunchaku/scripts/download_models.py
HF_TOKEN=${{ secrets.HF_TOKEN }} python custom_nodes/ComfyUI-nunchaku/scripts/download_test_data.py
- name: Run ComfyUI tests
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
pwd
cd ../ComfyUI
python nunchaku_tests/scripts/nunchaku_flux1_dev.py
pytest -v nunchaku_tests/
- name: Nunchaku FLUX memory tests
run: |
pwd
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_AMPERE }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/flux/test_flux_memory.py
test-flux-other:
needs: build
runs-on: [ self-hosted, ampere ]
timeout-minutes: 150
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
steps:
- name: Run other FLUX tests
- name: Nunchaku FLUX example tests
run: |
which python
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_AMPERE }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/flux --ignore=tests/flux/test_flux_memory.py
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_AMPERE }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/flux/test_flux_examples.py
test-sana:
needs: build
runs-on: [ self-hosted, ampere ]
timeout-minutes: 60
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
steps:
- name: Run SANA tests
- name: Nunchaku FLUX other tests
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_AMPERE }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/flux --ignore=tests/flux/test_flux_memory.py --ignore=tests/flux/test_flux_examples.py
- name: Nunchaku SANA tests
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
......@@ -162,11 +168,10 @@ jobs:
clean-up:
if: always() && (github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true')
needs: [ set-up-build-env, test-flux-memory, test-flux-other, test-sana ]
needs: [ run-tests ]
runs-on: [ self-hosted, ampere ]
steps:
- name: Clean up
run: |
cd ..
rm -rf *nunchaku*
rm -rf *nunchaku* *ComfyUI*
......@@ -36,7 +36,6 @@ on:
# issue_comment:
# types: [ created ]
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
......@@ -58,7 +57,7 @@ jobs:
echo "should_run=false" >> $GITHUB_OUTPUT
fi
set-up-build-env:
run-tests:
runs-on: [ self-hosted, blackwell ]
needs: [ check-comment ]
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
......@@ -75,7 +74,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
# ref: ${{ github.event.pull_request.head.sha || github.sha }}
ref: ${{ steps.set-ref.outputs.ref }}
submodules: true
......@@ -95,18 +93,10 @@ jobs:
which python
conda install -c conda-forge gxx=11 gcc=11
echo "Installing dependencies"
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
pip install ninja wheel diffusers transformers accelerate sentencepiece protobuf huggingface_hub
build:
needs: set-up-build-env
runs-on: [ self-hosted, blackwell ]
timeout-minutes: 30
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
pip install torch==2.7 torchvision==0.22 torchaudio==2.7 --index-url https://download.pytorch.org/whl/cu128
pip install ninja wheel diffusers==0.33.1 transformers==4.51 accelerate==1.7 sentencepiece==0.2 protobuf==6.31 huggingface_hub==0.31
steps:
- name: Run build tests
- name: Build
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
......@@ -114,47 +104,63 @@ jobs:
NUNCHAKU_INSTALL_MODE=ALL python setup.py develop
pip install -r tests/requirements.txt
test-flux-memory:
needs: build
runs-on: [ self-hosted, blackwell ]
timeout-minutes: 30
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
steps:
- name: Run FLUX memory test
- name: Setup ComfyUI
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
pwd
cd ..
pip install comfy-cli
yes | comfy --here install --nvidia --skip-torch-or-directml --version 0.3.34
cd ComfyUI
rm -r models
mkdir -p ${{ secrets.COMFYUI_MODELS_ROOT_BLACKWELL }}
ln -s ${{ secrets.COMFYUI_MODELS_ROOT_BLACKWELL }} models
cd custom_nodes
git clone -b dev https://github.com/mit-han-lab/ComfyUI-nunchaku.git
cd ..
pip install -r custom_nodes/ComfyUI-nunchaku/requirements.txt
comfy node install comfyui_controlnet_aux
comfy node install comfyui-inpainteasy
cp -r custom_nodes/ComfyUI-nunchaku/tests nunchaku_tests
pip install -r nunchaku_tests/requirements.txt
HF_TOKEN=${{ secrets.HF_TOKEN }} python custom_nodes/ComfyUI-nunchaku/scripts/download_models.py
HF_TOKEN=${{ secrets.HF_TOKEN }} python custom_nodes/ComfyUI-nunchaku/scripts/download_test_data.py
- name: Run ComfyUI tests
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
pwd
cd ../ComfyUI
python nunchaku_tests/scripts/nunchaku_flux1_dev.py
pytest -v nunchaku_tests/
- name: Nunchaku FLUX memory tests
run: |
pwd
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_BLACKWELL }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/flux/test_flux_memory.py
test-flux-other:
needs: build
runs-on: [ self-hosted, blackwell ]
timeout-minutes: 150
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
steps:
- name: Run other FLUX tests
- name: Nunchaku FLUX example tests
run: |
which python
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_BLACKWELL }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/flux --ignore=tests/flux/test_flux_memory.py
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_BLACKWELL }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/flux/test_flux_examples.py
test-sana:
needs: build
runs-on: [ self-hosted, blackwell ]
timeout-minutes: 60
if: ${{ github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true' }}
steps:
- name: Run SANA tests
- name: Nunchaku FLUX other tests
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
NUNCHAKU_TEST_CACHE_ROOT=${{ secrets.NUNCHAKU_TEST_CACHE_ROOT_BLACKWELL }} HF_TOKEN=${{ secrets.HF_TOKEN }} pytest -v tests/flux --ignore=tests/flux/test_flux_memory.py --ignore=tests/flux/test_flux_examples.py
- name: Nunchaku SANA tests
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate test_env || { echo "Failed to activate conda env"; exit 1; }
which python
......@@ -162,11 +168,10 @@ jobs:
clean-up:
if: always() && (github.event_name != 'issue_comment' || needs.check-comment.outputs.should_run == 'true')
needs: [ set-up-build-env, test-flux-memory, test-flux-other, test-sana ]
needs: [ run-tests ]
runs-on: [ self-hosted, blackwell ]
steps:
- name: Clean up
run: |
cd ..
rm -rf *nunchaku*
rm -rf *nunchaku* *ComfyUI*
......@@ -20,9 +20,9 @@ for %%P in (%python_versions%) do (
)
)
call scripts\build_windows_wheel_cu128.cmd 3.10 2.7 12.8
call scripts\build_windows_wheel_cu128.cmd 3.11 2.7 12.8
call scripts\build_windows_wheel_cu128.cmd 3.12 2.7 12.8
call scripts\build_windows_wheel.cmd 3.10 2.7 12.8
call scripts\build_windows_wheel.cmd 3.11 2.7 12.8
call scripts\build_windows_wheel.cmd 3.12 2.7 12.8
REM call scripts\build_windows_wheel_cu128.cmd 3.10 2.8 12.8
REM call scripts\build_windows_wheel_cu128.cmd 3.11 2.8 12.8
......
......@@ -10,7 +10,7 @@ from .utils import run_test
"height,width,attention_impl,cpu_offload,expected_lpips",
[
(1024, 1024, "flashattn2", False, 0.126 if get_precision() == "int4" else 0.126),
(1024, 1024, "nunchaku-fp16", False, 0.126 if get_precision() == "int4" else 0.126),
(1024, 1024, "nunchaku-fp16", False, 0.139 if get_precision() == "int4" else 0.126),
(1920, 1080, "nunchaku-fp16", False, 0.190 if get_precision() == "int4" else 0.138),
(2048, 2048, "nunchaku-fp16", True, 0.166 if get_precision() == "int4" else 0.120),
],
......
......@@ -40,7 +40,7 @@ def test_flux_depth_dev():
attention_impl="nunchaku-fp16",
cpu_offload=False,
cache_threshold=0,
expected_lpips=0.137 if get_precision() == "int4" else 0.092,
expected_lpips=0.137 if get_precision() == "int4" else 0.102,
)
......
......@@ -44,4 +44,4 @@ def test_lora_reset():
lpips = compute_lpips(os.path.join(save_dir, "before.png"), os.path.join(save_dir, "after.png"))
print(f"LPIPS: {lpips}")
assert lpips < 0.158 * 1.1
assert lpips < 0.179 * 1.1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment