From b7f535fcca6a000fc15d892b6f3250b3ca9627cf Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 20 Oct 2025 10:50:10 -1000 Subject: [PATCH 1/7] remove push_tests_fast --- .github/workflows/push_tests_fast.yml | 94 --------------------------- 1 file changed, 94 deletions(-) delete mode 100644 .github/workflows/push_tests_fast.yml diff --git a/.github/workflows/push_tests_fast.yml b/.github/workflows/push_tests_fast.yml deleted file mode 100644 index 6b1dd0b2d006..000000000000 --- a/.github/workflows/push_tests_fast.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Fast tests on main - -on: - push: - branches: - - main - paths: - - "src/diffusers/**.py" - - "examples/**.py" - - "tests/**.py" - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - DIFFUSERS_IS_CI: yes - HF_HOME: /mnt/cache - OMP_NUM_THREADS: 8 - MKL_NUM_THREADS: 8 - HF_HUB_ENABLE_HF_TRANSFER: 1 - PYTEST_TIMEOUT: 600 - RUN_SLOW: no - -jobs: - run_fast_tests: - strategy: - fail-fast: false - matrix: - config: - - name: Fast PyTorch CPU tests on Ubuntu - framework: pytorch - runner: aws-general-8-plus - image: diffusers/diffusers-pytorch-cpu - report: torch_cpu - - name: PyTorch Example CPU tests on Ubuntu - framework: pytorch_examples - runner: aws-general-8-plus - image: diffusers/diffusers-pytorch-cpu - report: torch_example_cpu - - name: ${{ matrix.config.name }} - - runs-on: - group: ${{ matrix.config.runner }} - - container: - image: ${{ matrix.config.image }} - options: --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/ - - defaults: - run: - shell: bash - - steps: - - name: Checkout diffusers - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Install dependencies - run: | - uv pip install -e ".[quality]" - - - name: Environment - run: | - python utils/print_env.py - - - name: Run fast PyTorch CPU tests - if: ${{ matrix.config.framework == 'pytorch' }} - run: | - pytest -n 4 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx" \ - --make-reports=tests_${{ matrix.config.report }} \ - tests/ - - - name: Run example PyTorch CPU tests - if: ${{ matrix.config.framework == 'pytorch_examples' }} - run: | - uv pip install ".[training]" - pytest -n 4 --max-worker-restart=0 --dist=loadfile \ - --make-reports=tests_${{ matrix.config.report }} \ - examples - - - name: Failure short reports - if: ${{ failure() }} - run: cat reports/tests_${{ matrix.config.report }}_failures_short.txt - - - name: Test suite reports artifacts - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: pr_${{ matrix.config.report }}_test_reports - path: reports From 650d327b9c6afba70926363e6328223cfe5ac93b Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 20 Oct 2025 10:55:39 -1000 Subject: [PATCH 2/7] rename. --- .github/workflows/push_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push_tests.yml b/.github/workflows/push_tests.yml index a1f5e121537d..5c4a1aea37d4 100644 --- a/.github/workflows/push_tests.yml +++ b/.github/workflows/push_tests.yml @@ -181,7 +181,7 @@ jobs: - name: Environment run: | python utils/print_env.py - - name: Run example tests on GPU + - name: Run fast compilation on GPU env: HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} RUN_COMPILE: yes From d7d76c5034e221fcecce9b9082017d9bc7f9c0a9 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 20 Oct 2025 10:59:29 -1000 Subject: [PATCH 3/7] remove compilation tests on merge. --- .github/workflows/push_tests.yml | 42 -------------------------------- 1 file changed, 42 deletions(-) diff --git a/.github/workflows/push_tests.yml b/.github/workflows/push_tests.yml index 5c4a1aea37d4..a3952c68ce09 100644 --- a/.github/workflows/push_tests.yml +++ b/.github/workflows/push_tests.yml @@ -156,48 +156,6 @@ jobs: name: torch_cuda_test_reports_${{ matrix.module }} path: reports - run_torch_compile_tests: - name: PyTorch Compile CUDA tests - - runs-on: - group: aws-g4dn-2xlarge - - container: - image: diffusers/diffusers-pytorch-cuda - options: --gpus all --shm-size "16gb" --ipc host - - steps: - - name: Checkout diffusers - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: NVIDIA-SMI - run: | - nvidia-smi - - name: Install dependencies - run: | - uv pip install -e ".[quality,training]" - - name: Environment - run: | - python utils/print_env.py - - name: Run fast compilation on GPU - env: - HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} - RUN_COMPILE: yes - run: | - pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v -k "compile" --make-reports=tests_torch_compile_cuda tests/ - - name: Failure short reports - if: ${{ failure() }} - run: cat reports/tests_torch_compile_cuda_failures_short.txt - - - name: Test suite reports artifacts - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: torch_compile_test_reports - path: reports - run_xformers_tests: name: PyTorch xformers CUDA tests From cee42bcfa6527f26e71a56ce9fcef6a555ba1e54 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 20 Oct 2025 11:12:27 -1000 Subject: [PATCH 4/7] up --- tests/conftest.py | 1 + tests/models/test_modeling_common.py | 8 ++++---- tests/testing_utils.py | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index fd76d1c84ee7..9d384c281800 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -32,6 +32,7 @@ def pytest_configure(config): config.addinivalue_line("markers", "big_accelerator: marks tests as requiring big accelerator resources") + config.addinivalue_line("markers", "is_torch_compile: marks torch compilation tests") def pytest_addoption(parser): diff --git a/tests/models/test_modeling_common.py b/tests/models/test_modeling_common.py index 6f4c3d544b45..4e50a677a09c 100644 --- a/tests/models/test_modeling_common.py +++ b/tests/models/test_modeling_common.py @@ -69,13 +69,13 @@ backend_synchronize, check_if_dicts_are_equal, get_python_version, - is_torch_compile, numpy_cosine_similarity_distance, require_peft_backend, require_peft_version_greater, require_torch_2, require_torch_accelerator, require_torch_accelerator_with_training, + require_torch_compile, require_torch_multi_accelerator, require_torch_version_greater, run_test_in_subprocess, @@ -783,7 +783,7 @@ def test_from_save_pretrained_variant(self, expected_max_diff=5e-5): max_diff = (image - new_image).abs().max().item() self.assertLessEqual(max_diff, expected_max_diff, "Models give different forward passes") - @is_torch_compile + @require_torch_compile @require_torch_2 @unittest.skipIf( get_python_version == (3, 12), @@ -2038,7 +2038,7 @@ def test_push_to_hub_library_name(self): @require_torch_accelerator @require_torch_2 -@is_torch_compile +@require_torch_compile @slow @require_torch_version_greater("2.7.1") class TorchCompileTesterMixin: @@ -2162,7 +2162,7 @@ def test_compile_works_with_aot(self): @require_peft_backend @require_peft_version_greater("0.14.0") @require_torch_version_greater("2.7.1") -@is_torch_compile +@require_torch_compile class LoraHotSwappingForModelTesterMixin: """Test that hotswapping does not result in recompilation on the model directly. diff --git a/tests/testing_utils.py b/tests/testing_utils.py index 7f849219c16f..c53ce0a0f079 100644 --- a/tests/testing_utils.py +++ b/tests/testing_utils.py @@ -447,6 +447,25 @@ def require_big_accelerator(test_case): )(test_case) +def require_torch_compile(test_case): + """ + Decorator marking compilation test. + """ + import pytest + + test_case = pytest.mark.is_torch_compile(test_case) + + if not is_torch_available(): + return unittest.skip("test requires PyTorch")(test_case) + + import torch + + if not (torch.cuda.is_available() or torch.xpu.is_available()): + return unittest.skip("test requires PyTorch CUDA")(test_case) + + return unittest.skipUnless(_run_compile_tests, "test is torch compile")(test_case) + + def require_torch_accelerator_with_training(test_case): """Decorator marking a test that requires an accelerator with support for training.""" return unittest.skipUnless( From 3716e91e6e6f50fb1b3c4e2a410928558dcaa87d Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 20 Oct 2025 11:13:49 -1000 Subject: [PATCH 5/7] u[p --- .github/workflows/nightly_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly_tests.yml b/.github/workflows/nightly_tests.yml index c8fa3a7ad93a..d8ee87da04f1 100644 --- a/.github/workflows/nightly_tests.yml +++ b/.github/workflows/nightly_tests.yml @@ -198,7 +198,7 @@ jobs: HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} RUN_COMPILE: yes run: | - pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v -k "compile" --make-reports=tests_torch_compile_cuda tests/ + pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v -m "is_torch_compile" --make-reports=tests_torch_compile_cuda tests/ - name: Failure short reports if: ${{ failure() }} run: cat reports/tests_torch_compile_cuda_failures_short.txt From 3f8759e240729c3ca91355562f8d60bd533667a0 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 20 Oct 2025 19:34:58 -1000 Subject: [PATCH 6/7] remove peft requirement --- tests/models/test_modeling_common.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/models/test_modeling_common.py b/tests/models/test_modeling_common.py index 4e50a677a09c..377133107bac 100644 --- a/tests/models/test_modeling_common.py +++ b/tests/models/test_modeling_common.py @@ -71,7 +71,6 @@ get_python_version, numpy_cosine_similarity_distance, require_peft_backend, - require_peft_version_greater, require_torch_2, require_torch_accelerator, require_torch_accelerator_with_training, @@ -2160,7 +2159,6 @@ def test_compile_works_with_aot(self): @require_torch_2 @require_torch_accelerator @require_peft_backend -@require_peft_version_greater("0.14.0") @require_torch_version_greater("2.7.1") @require_torch_compile class LoraHotSwappingForModelTesterMixin: From 72ce96ae5ab31e27fa5443beafbfb6bf4bfca3a6 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 20 Oct 2025 19:48:50 -1000 Subject: [PATCH 7/7] up --- .../transformers/test_models_transformer_skyreels_v2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/models/transformers/test_models_transformer_skyreels_v2.py b/tests/models/transformers/test_models_transformer_skyreels_v2.py index 8c36d8256ee9..75198d13cbb6 100644 --- a/tests/models/transformers/test_models_transformer_skyreels_v2.py +++ b/tests/models/transformers/test_models_transformer_skyreels_v2.py @@ -22,13 +22,13 @@ enable_full_determinism, torch_device, ) -from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin +from ..test_modeling_common import ModelTesterMixin enable_full_determinism() -class SkyReelsV2Transformer3DTests(ModelTesterMixin, TorchCompileTesterMixin, unittest.TestCase): +class SkyReelsV2Transformer3DTests(ModelTesterMixin, unittest.TestCase): model_class = SkyReelsV2Transformer3DModel main_input_name = "hidden_states" uses_custom_attn_processor = True