From e0162d7e77fa84c6ca61af7806e102638f879062 Mon Sep 17 00:00:00 2001 From: Sayak Paul Date: Tue, 24 Nov 2026 05:09:10 +0000 Subject: [PATCH] add fast modular gpu tests --- .github/workflows/pr_tests_gpu.yml | 62 ++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index bc48a4d1ac22..03671a763480 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -11,6 +11,8 @@ on: - "src/diffusers/models/model_loading_utils.py" - "src/diffusers/pipelines/pipeline_utils.py" - "src/diffusers/pipelines/pipeline_loading_utils.py" + - "src/diffusers/modular_pipelines/modular_pipeline.py" + - "src/diffusers/modular_pipelines/modular_pipeline_utils.py" - "src/diffusers/loaders/*lora*.py" - "src/diffusers/models/lora.py" - "src/diffusers/**/*peft*.py" @@ -18,6 +20,7 @@ on: - "src/diffusers/hooks/**" - "tests/hooks/**" - "tests/pipelines/testing_utils/**.py" + - "tests/modular_pipelines/testing_utils/**.py" - "tests/models/test_modeling_common.py" - "tests/models/testing_utils/**.py" - "examples/**/*.py" @@ -187,6 +190,65 @@ jobs: name: pipeline_${{ matrix.module }}_test_reports path: reports + torch_modular_pipelines_cuda_tests: + permissions: + contents: read + id-token: write + name: Torch Modular Pipelines CUDA Tests + needs: [check_code_quality, check_repository_consistency] + strategy: + fail-fast: false + max-parallel: 4 + matrix: + module: [flux, flux3, ltx2, minimax_h3, stable_diffusion_3, stable_diffusion_xl] + runs-on: + group: aws-g4dn-2xlarge + container: + image: diffusers/diffusers-pytorch-cuda:latest + options: --shm-size "16gb" --ipc host --gpus all + steps: + - name: Checkout diffusers + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 2 + + - name: NVIDIA-SMI + run: | + nvidia-smi + - name: Install dependencies + run: | + printf 'torch==2.10.0\ntorchvision==0.25.0\ntorchaudio==2.10.0\n' > "$UV_OVERRIDE" + uv pip install -e ".[quality]" + uv pip install peft@git+https://github.com/huggingface/peft.git + uv pip uninstall accelerate && uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git + uv pip uninstall transformers huggingface_hub && UV_PRERELEASE=allow uv pip install -U transformers@git+https://github.com/huggingface/transformers.git + + - name: Environment + run: | + diffusers-cli env + - name: PyTorch CUDA modular pipeline tests on Ubuntu + env: + HF_OIDC_RESOURCE: ${{ !github.event.pull_request.head.repo.fork && 'Diffusers-CI-Bot' || '' }} + # https://pytorch.org/docs/stable/notes/randomness.html#avoiding-nondeterministic-algorithms + CUBLAS_WORKSPACE_CONFIG: :16:8 + run: | + pytest -n 1 --max-worker-restart=0 --dist=loadfile \ + -m "core or memory or cpu_offload or group_offload or lora" \ + --make-reports=tests_modular_pipeline_${{ matrix.module }}_cuda \ + tests/modular_pipelines/${{ matrix.module }} + + - name: Failure short reports + if: ${{ failure() }} + run: | + cat reports/tests_modular_pipeline_${{ matrix.module }}_cuda_stats.txt + cat reports/tests_modular_pipeline_${{ matrix.module }}_cuda_failures_short.txt + - name: Test suite reports artifacts + if: ${{ always() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: modular_pipeline_${{ matrix.module }}_test_reports + path: reports + torch_cuda_tests: permissions: contents: read