From 94f657073f2ce8e87fddd278fb575dbc04c14879 Mon Sep 17 00:00:00 2001 From: DN6 Date: Fri, 21 Feb 2025 14:42:26 +0530 Subject: [PATCH 01/19] update --- .github/workflows/pr_tests_gpu.yml | 209 +++++++++++++++++++++++++++++ .github/workflows/push_tests.yml | 11 -- 2 files changed, 209 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/pr_tests_gpu.yml diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml new file mode 100644 index 000000000000..038e44d15efa --- /dev/null +++ b/.github/workflows/pr_tests_gpu.yml @@ -0,0 +1,209 @@ +name: Fast GPU Tests on PR + +on: + pull_request: + branches: main + paths: + - "src/diffusers/models/modeling_utils.py" + - "src/diffusers/models/model_loading_utils.py" + - "src/diffusers/pipelines/pipeline_utils.py" + - "src/diffusers/pipeline_loading_utils.py" + workflow_dispatch: +env: + DIFFUSERS_IS_CI: yes + OMP_NUM_THREADS: 8 + MKL_NUM_THREADS: 8 + HF_HUB_ENABLE_HF_TRANSFER: 1 + PYTEST_TIMEOUT: 600 + PIPELINE_USAGE_CUTOFF: 1000000000 # set high cutoff so that only always-test pipelines run + +jobs: + setup_torch_cuda_pipeline_matrix: + name: Setup Torch Pipelines CUDA Slow Tests Matrix + runs-on: + group: aws-general-8-plus + container: + image: diffusers/diffusers-pytorch-cpu + outputs: + pipeline_test_matrix: ${{ steps.fetch_pipeline_matrix.outputs.pipeline_test_matrix }} + steps: + - name: Checkout diffusers + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - name: Install dependencies + run: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python -m uv pip install -e [quality,test] + - name: Environment + run: | + python utils/print_env.py + - name: Fetch Pipeline Matrix + id: fetch_pipeline_matrix + run: | + matrix=$(python utils/fetch_torch_cuda_pipeline_test_matrix.py) + echo $matrix + echo "pipeline_test_matrix=$matrix" >> $GITHUB_OUTPUT + - name: Pipeline Tests Artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: test-pipelines.json + path: reports + + torch_pipelines_cuda_tests: + name: Torch Pipelines CUDA Tests + needs: setup_torch_cuda_pipeline_matrix + strategy: + fail-fast: false + max-parallel: 8 + matrix: + module: ${{ fromJson(needs.setup_torch_cuda_pipeline_matrix.outputs.pipeline_test_matrix) }} + runs-on: + group: aws-g4dn-2xlarge + container: + image: diffusers/diffusers-pytorch-cuda + options: --shm-size "16gb" --ipc host --gpus 0 + steps: + - name: Checkout diffusers + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - name: NVIDIA-SMI + run: | + nvidia-smi + - name: Install dependencies + run: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python -m uv pip install -e [quality,test] + pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git + - name: Environment + run: | + python utils/print_env.py + - name: PyTorch CUDA checkpoint tests on Ubuntu + env: + HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} + # https://pytorch.org/docs/stable/notes/randomness.html#avoiding-nondeterministic-algorithms + CUBLAS_WORKSPACE_CONFIG: :16:8 + run: | + python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ + -s -v -k "not Flax and not Onnx" \ + --make-reports=tests_pipeline_${{ matrix.module }}_cuda \ + tests/pipelines/${{ matrix.module }} + - name: Failure short reports + if: ${{ failure() }} + run: | + cat reports/tests_pipeline_${{ matrix.module }}_cuda_stats.txt + cat reports/tests_pipeline_${{ matrix.module }}_cuda_failures_short.txt + - name: Test suite reports artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: pipeline_${{ matrix.module }}_test_reports + path: reports + + torch_cuda_tests: + name: Torch CUDA Tests + runs-on: + group: aws-g4dn-2xlarge + container: + image: diffusers/diffusers-pytorch-cuda + options: --shm-size "16gb" --ipc host --gpus 0 + defaults: + run: + shell: bash + strategy: + fail-fast: false + max-parallel: 2 + matrix: + module: [models, schedulers, lora, others, single_file] + steps: + - name: Checkout diffusers + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Install dependencies + run: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python -m uv pip install -e [quality,test] + python -m uv pip install peft@git+https://github.com/huggingface/peft.git + pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git + + - name: Environment + run: | + python utils/print_env.py + + - name: Run PyTorch CUDA tests + env: + HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} + # https://pytorch.org/docs/stable/notes/randomness.html#avoiding-nondeterministic-algorithms + CUBLAS_WORKSPACE_CONFIG: :16:8 + run: | + python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ + -s -v -k "not Flax and not Onnx" \ + --make-reports=tests_torch_cuda_${{ matrix.module }} \ + tests/${{ matrix.module }} + + - name: Failure short reports + if: ${{ failure() }} + run: | + cat reports/tests_torch_cuda_${{ matrix.module }}_stats.txt + cat reports/tests_torch_cuda_${{ matrix.module }}_failures_short.txt + + - name: Test suite reports artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: torch_cuda_test_reports_${{ matrix.module }} + path: reports + + run_examples_tests: + name: Examples PyTorch CUDA tests on Ubuntu + + runs-on: + group: aws-g4dn-2xlarge + + container: + image: diffusers/diffusers-pytorch-cuda + options: --gpus 0 --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: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python -m uv pip install -e [quality,test,training] + + - name: Environment + run: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python utils/print_env.py + + - name: Run example tests on GPU + env: + HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} + run: | + python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" + python -m uv pip install timm + python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v --make-reports=examples_torch_cuda examples/ + + - name: Failure short reports + if: ${{ failure() }} + run: | + cat reports/examples_torch_cuda_stats.txt + cat reports/examples_torch_cuda_failures_short.txt + + - name: Test suite reports artifacts + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: examples_test_reports + path: reports + diff --git a/.github/workflows/push_tests.yml b/.github/workflows/push_tests.yml index 315375ee51fd..abf825eaa7a0 100644 --- a/.github/workflows/push_tests.yml +++ b/.github/workflows/push_tests.yml @@ -1,13 +1,6 @@ name: Fast GPU Tests on main on: - pull_request: - branches: main - paths: - - "src/diffusers/models/modeling_utils.py" - - "src/diffusers/models/model_loading_utils.py" - - "src/diffusers/pipelines/pipeline_utils.py" - - "src/diffusers/pipeline_loading_utils.py" workflow_dispatch: push: branches: @@ -167,7 +160,6 @@ jobs: path: reports flax_tpu_tests: - if: ${{ github.event_name != 'pull_request' }} name: Flax TPU Tests runs-on: group: gcp-ct5lp-hightpu-8t @@ -216,7 +208,6 @@ jobs: path: reports onnx_cuda_tests: - if: ${{ github.event_name != 'pull_request' }} name: ONNX CUDA Tests runs-on: group: aws-g4dn-2xlarge @@ -265,7 +256,6 @@ jobs: path: reports run_torch_compile_tests: - if: ${{ github.event_name != 'pull_request' }} name: PyTorch Compile CUDA tests runs-on: @@ -309,7 +299,6 @@ jobs: path: reports run_xformers_tests: - if: ${{ github.event_name != 'pull_request' }} name: PyTorch xformers CUDA tests runs-on: From 2cb2c67add8609c1ef0b97d00c01316ae691c6c2 Mon Sep 17 00:00:00 2001 From: DN6 Date: Fri, 21 Feb 2025 16:34:11 +0530 Subject: [PATCH 02/19] update --- .github/workflows/pr_tests_gpu.yml | 13 ++++++- utils/extract_tests_from_mixin.py | 62 ++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 utils/extract_tests_from_mixin.py diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 038e44d15efa..ce71fa90f927 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -80,6 +80,10 @@ jobs: - name: Environment run: | python utils/print_env.py + - name: Extract tests + run: | + pattern=$(python utils/extract_tests_from_mixin.py --type pipeline) + echo "TEST_PATTERN=$pattern" >> $GITHUB_ENV - name: PyTorch CUDA checkpoint tests on Ubuntu env: HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} @@ -116,7 +120,7 @@ jobs: fail-fast: false max-parallel: 2 matrix: - module: [models, schedulers, lora, others, single_file] + module: [models, schedulers, lora, others] steps: - name: Checkout diffusers uses: actions/checkout@v3 @@ -134,6 +138,11 @@ jobs: run: | python utils/print_env.py + - name: Extract tests + run: | + pattern=$(python utils/extract_tests_from_mixin.py --type ${{ matrix.module }}) + echo "TEST_PATTERN=$pattern" >> $GITHUB_ENV + - name: Run PyTorch CUDA tests env: HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} @@ -141,7 +150,7 @@ jobs: CUBLAS_WORKSPACE_CONFIG: :16:8 run: | python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx" \ + -s -v -k "not Flax and not Onnx and $TEST_PATTERN" \ --make-reports=tests_torch_cuda_${{ matrix.module }} \ tests/${{ matrix.module }} diff --git a/utils/extract_tests_from_mixin.py b/utils/extract_tests_from_mixin.py new file mode 100644 index 000000000000..4367a2483f42 --- /dev/null +++ b/utils/extract_tests_from_mixin.py @@ -0,0 +1,62 @@ +import inspect +import argparse +import os +import sys +from typing import Type, List +from pathlib import Path + +root_dir = Path(__file__).parent.parent.absolute() +sys.path.insert(0, str(root_dir)) + +parser = argparse.ArgumentParser() +parser.add_argument("--type", type=str, default=None) +args = parser.parse_args() + + +def get_test_methods_from_class(cls: Type) -> List[str]: + """ + Get all test method names from a given class. + Only returns methods that start with 'test_'. + """ + test_methods = [] + for name, obj in inspect.getmembers(cls): + if name.startswith("test_") and inspect.isfunction(obj): + test_methods.append(name) + return sorted(test_methods) + + +def generate_pytest_pattern(test_methods: List[str]) -> str: + """Generate pytest pattern string for the -k flag.""" + return " or ".join(test_methods) + + +def generate_pattern_for_mixin(mixin_class: Type) -> str: + """ + Generate pytest pattern for a specific mixin class. + """ + if mixin_cls is None: + return "" + test_methods = get_test_methods_from_class(mixin_class) + return generate_pytest_pattern(test_methods) + + +if __name__ == "__main__": + mixin_cls = None + if args.type == "pipeline": + from tests.pipelines.test_pipelines_common import PipelineTesterMixin + + mixin_cls = PipelineTesterMixin + + elif args.type == "models": + from tests.models.test_modeling_common import ModelTesterMixin + + mixin_cls = ModelTesterMixin + + elif args.type == "lora": + from tests.lora.utils import PeftLoraLoaderMixinTests + + mixin_cls = PeftLoraLoaderMixinTests + + pattern = generate_pattern_for_mixin(mixin_cls) + print(pattern) + From 081db07309817274d44479f75a4552b201bb3f2c Mon Sep 17 00:00:00 2001 From: DN6 Date: Fri, 21 Feb 2025 16:49:12 +0530 Subject: [PATCH 03/19] update --- utils/extract_tests_from_mixin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/utils/extract_tests_from_mixin.py b/utils/extract_tests_from_mixin.py index 4367a2483f42..c8b65b96ee16 100644 --- a/utils/extract_tests_from_mixin.py +++ b/utils/extract_tests_from_mixin.py @@ -1,9 +1,9 @@ -import inspect import argparse -import os +import inspect import sys -from typing import Type, List from pathlib import Path +from typing import List, Type + root_dir = Path(__file__).parent.parent.absolute() sys.path.insert(0, str(root_dir)) @@ -59,4 +59,3 @@ def generate_pattern_for_mixin(mixin_class: Type) -> str: pattern = generate_pattern_for_mixin(mixin_cls) print(pattern) - From 8e7138bd48dafa1df686b5c245c68812000f779c Mon Sep 17 00:00:00 2001 From: DN6 Date: Fri, 21 Feb 2025 19:05:12 +0530 Subject: [PATCH 04/19] update --- .github/workflows/pr_tests_gpu.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index ce71fa90f927..47219a6fc0b4 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -8,6 +8,10 @@ on: - "src/diffusers/models/model_loading_utils.py" - "src/diffusers/pipelines/pipeline_utils.py" - "src/diffusers/pipeline_loading_utils.py" + - "src/diffusers/loaders/lora_base.py" + - "src/diffusers/loaders/lora_pipeline.py" + - "src/diffusers/loaders/peft.py" + - "src/diffusers/loaders/ip_adapter.py" workflow_dispatch: env: DIFFUSERS_IS_CI: yes @@ -133,6 +137,7 @@ jobs: python -m uv pip install -e [quality,test] python -m uv pip install peft@git+https://github.com/huggingface/peft.git pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git + pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps - name: Environment run: | From 0686548bcb0c806b6d2b636fc78f13ec8e24336a Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 12:38:05 +0530 Subject: [PATCH 05/19] update --- .github/workflows/pr_tests_gpu.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 47219a6fc0b4..95a96fae087c 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -13,6 +13,11 @@ on: - "src/diffusers/loaders/peft.py" - "src/diffusers/loaders/ip_adapter.py" workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + env: DIFFUSERS_IS_CI: yes OMP_NUM_THREADS: 8 From 4b2276992e8e297bec4edcab8a14ceb96d59899e Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 13:07:11 +0530 Subject: [PATCH 06/19] update --- .github/workflows/pr_tests_gpu.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 95a96fae087c..2931e6c75863 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -78,6 +78,7 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 2 + - name: NVIDIA-SMI run: | nvidia-smi @@ -86,13 +87,17 @@ jobs: python -m venv /opt/venv && export PATH="/opt/venv/bin:$PATH" python -m uv pip install -e [quality,test] pip uninstall accelerate -y && python -m uv pip install -U accelerate@git+https://github.com/huggingface/accelerate.git + pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps + - name: Environment run: | python utils/print_env.py - name: Extract tests + id: extract_tests run: | pattern=$(python utils/extract_tests_from_mixin.py --type pipeline) - echo "TEST_PATTERN=$pattern" >> $GITHUB_ENV + echo "TEST_PATTERN=${pattern}" >> $GITHUB_OUTPUT + - name: PyTorch CUDA checkpoint tests on Ubuntu env: HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }} @@ -100,9 +105,10 @@ jobs: CUBLAS_WORKSPACE_CONFIG: :16:8 run: | python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx" \ + -s -v -k "not Flax and not Onnx ${{ steps.extract_tests.outputs.TEST_PATTERN }}" \ --make-reports=tests_pipeline_${{ matrix.module }}_cuda \ tests/pipelines/${{ matrix.module }} + - name: Failure short reports if: ${{ failure() }} run: | @@ -149,9 +155,10 @@ jobs: python utils/print_env.py - name: Extract tests + id: extract_tests run: | pattern=$(python utils/extract_tests_from_mixin.py --type ${{ matrix.module }}) - echo "TEST_PATTERN=$pattern" >> $GITHUB_ENV + echo "TEST_PATTERN=${pattern}" >> $GITHUB_OUTPUT - name: Run PyTorch CUDA tests env: @@ -160,7 +167,7 @@ jobs: CUBLAS_WORKSPACE_CONFIG: :16:8 run: | python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx and $TEST_PATTERN" \ + -s -v -k "not Flax and not Onnx and ${{ steps.extract_tests.outputs.TEST_PATTERN }}" \ --make-reports=tests_torch_cuda_${{ matrix.module }} \ tests/${{ matrix.module }} @@ -179,7 +186,7 @@ jobs: run_examples_tests: name: Examples PyTorch CUDA tests on Ubuntu - + pip uninstall transformers -y && python -m uv pip install -U transformers@git+https://github.com/huggingface/transformers.git --no-deps runs-on: group: aws-g4dn-2xlarge From 24cebce3343309fb5793b17c32eacbe6bdb8f7a4 Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 22:01:25 +0530 Subject: [PATCH 07/19] test --- src/diffusers/models/modeling_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/diffusers/models/modeling_utils.py b/src/diffusers/models/modeling_utils.py index 4fbbd78667e3..b42a5a77684e 100644 --- a/src/diffusers/models/modeling_utils.py +++ b/src/diffusers/models/modeling_utils.py @@ -72,6 +72,8 @@ load_state_dict, ) +print("test") + class ContextManagers: """ From 12cd2a2a223695f52104926994787f67286387f2 Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 22:12:52 +0530 Subject: [PATCH 08/19] test --- .github/workflows/pr_tests_gpu.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 2931e6c75863..b6c28e4bbdf0 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -96,7 +96,8 @@ jobs: id: extract_tests run: | pattern=$(python utils/extract_tests_from_mixin.py --type pipeline) - echo "TEST_PATTERN=${pattern}" >> $GITHUB_OUTPUT + echo "$pattern" > /tmp/test_pattern.txt + echo "pattern_file=/tmp/test_pattern.txt" >> $GITHUB_OUTPUT - name: PyTorch CUDA checkpoint tests on Ubuntu env: @@ -104,8 +105,9 @@ jobs: # https://pytorch.org/docs/stable/notes/randomness.html#avoiding-nondeterministic-algorithms CUBLAS_WORKSPACE_CONFIG: :16:8 run: | + pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx ${{ steps.extract_tests.outputs.TEST_PATTERN }}" \ + -s -v -k "not Flax and not Onnx \"$pattern\"" \ --make-reports=tests_pipeline_${{ matrix.module }}_cuda \ tests/pipelines/${{ matrix.module }} @@ -158,7 +160,8 @@ jobs: id: extract_tests run: | pattern=$(python utils/extract_tests_from_mixin.py --type ${{ matrix.module }}) - echo "TEST_PATTERN=${pattern}" >> $GITHUB_OUTPUT + echo "$pattern" > /tmp/test_pattern.txt + echo "pattern_file=/tmp/test_pattern.txt" >> $GITHUB_OUTPUT - name: Run PyTorch CUDA tests env: @@ -166,8 +169,9 @@ jobs: # https://pytorch.org/docs/stable/notes/randomness.html#avoiding-nondeterministic-algorithms CUBLAS_WORKSPACE_CONFIG: :16:8 run: | + pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx and ${{ steps.extract_tests.outputs.TEST_PATTERN }}" \ + -s -v -k "not Flax and not Onnx and \"$pattern\"" \ --make-reports=tests_torch_cuda_${{ matrix.module }} \ tests/${{ matrix.module }} From 14d47d3397862a88aacceb6bb56a12d7a2215f06 Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 22:22:06 +0530 Subject: [PATCH 09/19] test --- .github/workflows/pr_tests_gpu.yml | 2 +- src/diffusers/models/modeling_utils.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index b6c28e4bbdf0..1b46ea17a8d0 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -171,7 +171,7 @@ jobs: run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx and \"$pattern\"" \ + -s -v -k "not Flax and not Onnx and $pattern" \ --make-reports=tests_torch_cuda_${{ matrix.module }} \ tests/${{ matrix.module }} diff --git a/src/diffusers/models/modeling_utils.py b/src/diffusers/models/modeling_utils.py index b42a5a77684e..c85b98049754 100644 --- a/src/diffusers/models/modeling_utils.py +++ b/src/diffusers/models/modeling_utils.py @@ -72,6 +72,7 @@ load_state_dict, ) + print("test") From efca39557ca8af2326ff1d3ddb65894f25ac1354 Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 22:46:42 +0530 Subject: [PATCH 10/19] test --- .github/workflows/pr_tests_gpu.yml | 2 +- src/diffusers/models/modeling_utils.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 1b46ea17a8d0..1dd701c24c3c 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -107,7 +107,7 @@ jobs: run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx \"$pattern\"" \ + -s -v -k "not Flax and not Onnx and $pattern" \ --make-reports=tests_pipeline_${{ matrix.module }}_cuda \ tests/pipelines/${{ matrix.module }} diff --git a/src/diffusers/models/modeling_utils.py b/src/diffusers/models/modeling_utils.py index c85b98049754..22db65f15cc0 100644 --- a/src/diffusers/models/modeling_utils.py +++ b/src/diffusers/models/modeling_utils.py @@ -73,9 +73,6 @@ ) -print("test") - - class ContextManagers: """ Wrapper for `contextlib.ExitStack` which enters a collection of context managers. Adaptation of `ContextManagers` @@ -95,7 +92,7 @@ def __exit__(self, *args, **kwargs): logger = logging.get_logger(__name__) - +logger.debug("testing") _REGEX_SHARD = re.compile(r"(.*?)-\d{5}-of-\d{5}") TORCH_INIT_FUNCTIONS = { From 6eb2053f7e943c5ece1110e36d3402106b9dccbc Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 23:41:39 +0530 Subject: [PATCH 11/19] test --- .github/workflows/pr_tests_gpu.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 1dd701c24c3c..cb0413886ff6 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -170,10 +170,13 @@ jobs: CUBLAS_WORKSPACE_CONFIG: :16:8 run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) - python -m pytest -n 1 --max-worker-restart=0 --dist=loadfile \ - -s -v -k "not Flax and not Onnx and $pattern" \ - --make-reports=tests_torch_cuda_${{ matrix.module }} \ - tests/${{ matrix.module }} + if [ -z "$pattern" ]; then + # If pattern is empty, run without specific tests pattern + python -m pytest -n 1 -k "not Flax and not Onnx" tests/${{ matrix.module }} + else + # If pattern exists, use it + python -m pytest -n 1 -k "not Flax and not Onnx and \"$pattern\"" tests/${{ matrix.module }} + fi - name: Failure short reports if: ${{ failure() }} From e7398fc0552e95729eaf84375670b3cdbe47afaf Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 23:51:08 +0530 Subject: [PATCH 12/19] test --- .github/workflows/pr_tests_gpu.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index cb0413886ff6..a96d1ca7e12d 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -11,7 +11,6 @@ on: - "src/diffusers/loaders/lora_base.py" - "src/diffusers/loaders/lora_pipeline.py" - "src/diffusers/loaders/peft.py" - - "src/diffusers/loaders/ip_adapter.py" workflow_dispatch: concurrency: @@ -171,11 +170,9 @@ jobs: run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) if [ -z "$pattern" ]; then - # If pattern is empty, run without specific tests pattern - python -m pytest -n 1 -k "not Flax and not Onnx" tests/${{ matrix.module }} + python -m pytest -n 1 -sv -k --max-worker-restart=0 --dist=loadfile "not Flax and not Onnx" tests/${{ matrix.module }} else - # If pattern exists, use it - python -m pytest -n 1 -k "not Flax and not Onnx and \"$pattern\"" tests/${{ matrix.module }} + python -m pytest -n 1 -sv -k --max-worker-restart=0 --dist=loadfile "not Flax and not Onnx and $pattern" tests/${{ matrix.module }} fi - name: Failure short reports From c20b71001bbf7f0c901940c81b34abcecdc6608e Mon Sep 17 00:00:00 2001 From: DN6 Date: Mon, 24 Feb 2025 23:57:13 +0530 Subject: [PATCH 13/19] test --- .github/workflows/pr_tests_gpu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index a96d1ca7e12d..55336c6be2c8 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -170,9 +170,9 @@ jobs: run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) if [ -z "$pattern" ]; then - python -m pytest -n 1 -sv -k --max-worker-restart=0 --dist=loadfile "not Flax and not Onnx" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} else - python -m pytest -n 1 -sv -k --max-worker-restart=0 --dist=loadfile "not Flax and not Onnx and $pattern" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx and $pattern" tests/${{ matrix.module }} fi - name: Failure short reports From 36964a739acc39bff70efaaf7a403ca31353360a Mon Sep 17 00:00:00 2001 From: DN6 Date: Tue, 25 Feb 2025 00:12:24 +0530 Subject: [PATCH 14/19] test --- .github/workflows/pr_tests_gpu.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 55336c6be2c8..3cd9734302fc 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -170,9 +170,13 @@ jobs: run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) if [ -z "$pattern" ]; then - python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} + python -m pytest -n 1 -sv \ + --make-reports=tests_torch_cuda_${{ matrix.module }}_stats \ + --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} else - python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx and $pattern" tests/${{ matrix.module }} + python -m pytest -n 1 -sv \ + --make-reports=tests_torch_cuda_${{ matrix.module }}_stats \ + --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx $pattern" tests/${{ matrix.module }} fi - name: Failure short reports From 5b2528f169a337287a5bd155cf6028c7e5606715 Mon Sep 17 00:00:00 2001 From: DN6 Date: Tue, 25 Feb 2025 00:26:26 +0530 Subject: [PATCH 15/19] test --- .github/workflows/pr_tests_gpu.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 3cd9734302fc..b9768cc82931 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -170,13 +170,9 @@ jobs: run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) if [ -z "$pattern" ]; then - python -m pytest -n 1 -sv \ - --make-reports=tests_torch_cuda_${{ matrix.module }}_stats \ - --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --make-reports=tests_torch_cuda_${{ matrix.module }}_stats --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} else - python -m pytest -n 1 -sv \ - --make-reports=tests_torch_cuda_${{ matrix.module }}_stats \ - --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx $pattern" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --make-reports=tests_torch_cuda_${{ matrix.module }}_stats --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx $pattern" tests/${{ matrix.module }} fi - name: Failure short reports From 1ee7d788829f69cfcada245117cf4812aa69bac7 Mon Sep 17 00:00:00 2001 From: DN6 Date: Tue, 25 Feb 2025 00:32:22 +0530 Subject: [PATCH 16/19] test --- .github/workflows/pr_tests_gpu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index b9768cc82931..ea3eb24be073 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -170,9 +170,9 @@ jobs: run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) if [ -z "$pattern" ]; then - python -m pytest -n 1 -sv --make-reports=tests_torch_cuda_${{ matrix.module }}_stats --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} else - python -m pytest -n 1 -sv --make-reports=tests_torch_cuda_${{ matrix.module }}_stats --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx $pattern" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx $pattern" tests/${{ matrix.module }} fi - name: Failure short reports From 57bc10e0ee66b38efcd85d4d14d3165e6d4e5ed4 Mon Sep 17 00:00:00 2001 From: DN6 Date: Tue, 25 Feb 2025 00:36:19 +0530 Subject: [PATCH 17/19] test --- .github/workflows/pr_tests_gpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index ea3eb24be073..55336c6be2c8 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -172,7 +172,7 @@ jobs: if [ -z "$pattern" ]; then python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} else - python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx $pattern" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx and $pattern" tests/${{ matrix.module }} fi - name: Failure short reports From 952b473d36ee26f2d32d736b62b2b038d0805fb2 Mon Sep 17 00:00:00 2001 From: DN6 Date: Tue, 25 Feb 2025 00:54:09 +0530 Subject: [PATCH 18/19] test --- .github/workflows/pr_tests_gpu.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 55336c6be2c8..9a73c6053e87 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -170,9 +170,11 @@ jobs: run: | pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) if [ -z "$pattern" ]; then - python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} \ + --make-reports=tests_torch_cuda_${{ matrix.module }}_stats else - python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx and $pattern" tests/${{ matrix.module }} + python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx and $pattern" tests/${{ matrix.module }} \ + --make-reports=tests_torch_cuda_${{ matrix.module }}_stats fi - name: Failure short reports From 1fed6b2e39362098d08416d87c7f424fda523d00 Mon Sep 17 00:00:00 2001 From: DN6 Date: Tue, 25 Feb 2025 01:04:07 +0530 Subject: [PATCH 19/19] update --- .github/workflows/pr_tests_gpu.yml | 4 ++-- src/diffusers/models/modeling_utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_tests_gpu.yml b/.github/workflows/pr_tests_gpu.yml index 9a73c6053e87..a06689b5fad7 100644 --- a/.github/workflows/pr_tests_gpu.yml +++ b/.github/workflows/pr_tests_gpu.yml @@ -171,10 +171,10 @@ jobs: pattern=$(cat ${{ steps.extract_tests.outputs.pattern_file }}) if [ -z "$pattern" ]; then python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx" tests/${{ matrix.module }} \ - --make-reports=tests_torch_cuda_${{ matrix.module }}_stats + --make-reports=tests_torch_cuda_${{ matrix.module }} else python -m pytest -n 1 -sv --max-worker-restart=0 --dist=loadfile -k "not Flax and not Onnx and $pattern" tests/${{ matrix.module }} \ - --make-reports=tests_torch_cuda_${{ matrix.module }}_stats + --make-reports=tests_torch_cuda_${{ matrix.module }} fi - name: Failure short reports diff --git a/src/diffusers/models/modeling_utils.py b/src/diffusers/models/modeling_utils.py index 22db65f15cc0..4fbbd78667e3 100644 --- a/src/diffusers/models/modeling_utils.py +++ b/src/diffusers/models/modeling_utils.py @@ -92,7 +92,7 @@ def __exit__(self, *args, **kwargs): logger = logging.get_logger(__name__) -logger.debug("testing") + _REGEX_SHARD = re.compile(r"(.*?)-\d{5}-of-\d{5}") TORCH_INIT_FUNCTIONS = {