Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
341e55f
[CI] Rewrite `tests_fetcher.py` as an AST-based import-graph selector…
DN6 Aug 26, 2026
c7c8cc4
[tests] Import pipeline/model classes inside the tests that use them …
DN6 Aug 26, 2026
4242566
[CI] Give `single_file` model tests their own fetcher job; they need …
DN6 Aug 26, 2026
bd8d8b8
[tests] Keep `create_flux_ip_adapter_state_dict` in `test_models_tran…
DN6 Aug 26, 2026
b19052c
update
DN6 Sep 30, 2026
7e674e0
[CI] Detect the `main` branch by name in `tests_fetcher.py`; a branch…
DN6 Sep 30, 2026
dbc8d8a
[CI] Mark the workspace as a git safe directory before running `tests…
DN6 Sep 30, 2026
51e0728
[CI] Select core tests with a `core` marker derived from the `is_*` d…
DN6 Sep 30, 2026
e258130
[CI] Credit mixin markers only for bases imported from `testing_utils…
DN6 Oct 5, 2026
a8b2c8e
fix(ci): harden GitHub Actions workflows (#14607) (#14945)
hf-security-analysis[bot] Oct 5, 2026
a5af804
[CI] Count test files in the fetcher summary and add a row for modifi…
DN6 Oct 5, 2026
bc5488a
Merge remote-tracking branch 'origin/main' into update-tests-fetcher-…
DN6 Oct 6, 2026
bcfeaa9
[CI] Compare each modified file's test reach to the base commit in th…
DN6 Oct 13, 2026
7e67c09
[CI] Show each modified file's reach on branch and on main in the fet…
DN6 Oct 13, 2026
8b5edc1
[tests] Use the concrete pipeline classes instead of `AutoPipeline*` …
DN6 Nov 9, 2026
bc0e8cb
[tests] Ban `AutoPipeline*` imports in tests and switch the SD and SD…
DN6 Nov 9, 2026
fee0b30
[CI] Summarize the selection per changed file with a collapsible impo…
DN6 Nov 9, 2026
e44629d
Merge remote-tracking branch 'origin/main' into update-tests-fetcher-…
DN6 Nov 9, 2026
8668474
[CI] Flag test files that import a module which imports much of the l…
DN6 Nov 9, 2026
966349c
[CI] Give the tail of a wide diff its own nested dropdowns in the fet…
DN6 Nov 9, 2026
5835f5f
[CI] Call out changed files that run no tests and move the import tre…
DN6 Nov 9, 2026
40470d3
[tests] Import the Flux and SD3 transformers at module level in `test…
DN6 Nov 10, 2026
45905d6
[tests] Document `marker_decorators` with an example, name the file i…
DN6 Nov 16, 2026
14e737c
[CI] Obtain the Hub token for single-file tests through OIDC in the f…
DN6 Nov 16, 2026
e409a9f
[CI] Simplify `tests_fetcher.py` and use dashed CLI flags
DN6 Nov 16, 2026
2bd7b43
[CI] Write the matrix before the summary so a report failure cannot s…
DN6 Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions .github/workflows/pr_test_fetcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
shell: bash
outputs:
matrix: ${{ steps.set_matrix.outputs.matrix }}
test_map: ${{ steps.set_matrix.outputs.test_map }}
steps:
- name: Checkout diffusers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -44,42 +43,46 @@ jobs:
diffusers-cli env
echo $(git --version)
- name: Fetch Tests
# The checkout step only marks the workspace safe in a temporary git config, so git processes the
# fetcher spawns in the container would otherwise refuse the repo as dubiously owned.
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fetcher is currently in workflow_dispatch. Should it have a pull_request trigger? And then we should also make sure that the fetching script is always run from the base upstream (for security reasons)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think we would run this workflow manually for a little bit to verify that everything is working as expected and then run it by default on PRs and remove the current PR tests.

python utils/tests_fetcher.py | tee test_preparation.txt
- name: Report selection in job summary
run: |
if [ -f test_fetcher_summary.md ]; then
cat test_fetcher_summary.md >> $GITHUB_STEP_SUMMARY
fi
- name: Report fetched tests
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test_fetched
path: test_preparation.txt
- id: set_matrix
name: Create Test Matrix
# The `keys` is used as GitHub actions matrix for jobs, i.e. `models`, `pipelines`, etc.
# The `test_map` is used to get the actual identified test files under each key.
# If no test to run (so no `test_map.json` file), create a dummy map (empty matrix will fail)
# `test_map.json` is a list of matrix entries `{"name", "paths", "markers"}`, one job each.
# If no test to run (so no `test_map.json` file), emit an empty list and skip the test job.
run: |
if [ -f test_map.json ]; then
keys=$(python3 -c 'import json; fp = open("test_map.json"); test_map = json.load(fp); fp.close(); d = list(test_map.keys()); print(json.dumps(d))')
test_map=$(python3 -c 'import json; fp = open("test_map.json"); test_map = json.load(fp); fp.close(); print(json.dumps(test_map))')
matrix=$(python3 -c 'import json; print(json.dumps(json.load(open("test_map.json"))))')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have an example matrix for quick references?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  [
    {
      "name": "others",
      "paths": "tests/others/test_flashpack.py",
      "markers": ""
    },
    {
      "name": "pipelines-core",
      "paths": "tests/pipelines/kandinsky3/test_kandinsky3.py tests/pipelines/kandinsky3/test_kandinsky3_img2img.py tests/pipelines/pag/test_pag_sd.py tests/pipelines/pag/test_pag_sd3_img2img.py tests/pipelines/pag/test_pag_sd_img2img.py tests/pipelines/pag/test_pag_sd_inpaint.py tests/pipelines/pag/test_pag_sdxl.py tests/pipelines/pag/test_pag_sdxl_img2img.py tests/pipelines/pag/test_pag_sdxl_inpaint.py tests/pipelines/stable_diffusion/test_stable_diffusion.py tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl.py",
      "markers": "core"
    },
    {
      "name": "pipelines-lora",
      "paths": "<same 11 files>",
      "markers": "lora"
    },
    {
      "name": "pipelines-memory",
      "paths": "<same 11 files>",
      "markers": "memory or cpu_offload or group_offload"
    },
    {
      "name": "pipelines-ip_adapter",
      "paths": "<same 11 files>",
      "markers": "ip_adapter"
    }
  ]

else
keys=$(python3 -c 'keys = ["dummy"]; print(keys)')
test_map=$(python3 -c 'test_map = {"dummy": []}; print(test_map)')
matrix='[]'
fi
echo $keys
echo $test_map
echo "matrix=$keys" >> $GITHUB_OUTPUT
echo "test_map=$test_map" >> $GITHUB_OUTPUT
echo "matrix=$matrix" >> $GITHUB_OUTPUT
echo "Matrix: $matrix"

run_pr_tests:
permissions:
contents: read
name: Run PR Tests
id-token: write
name: ${{ matrix.name }}
needs: setup_pr_tests
if: contains(fromJson(needs.setup_pr_tests.outputs.matrix), 'dummy') != true
if: needs.setup_pr_tests.outputs.matrix != '[]'
strategy:
fail-fast: false
max-parallel: 2
matrix:
modules: ${{ fromJson(needs.setup_pr_tests.outputs.matrix) }}
include: ${{ fromJson(needs.setup_pr_tests.outputs.matrix) }}
runs-on:
group: aws-general-8-plus
container:
Expand All @@ -104,21 +107,27 @@ jobs:
diffusers-cli env

- name: Run all selected tests on CPU
# The gated single-file checkpoints need a Hub token, obtained through OIDC like the nightly and release
# workflows. Only runs that can mint an id token get the resource: a fork PR cannot, and huggingface_hub
# raises rather than falling back when `HF_OIDC_RESOURCE` is set with no id token, so there it is left
# empty and the `require_hf_token` tests skip instead.
env:
HF_OIDC_RESOURCE: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'Diffusers-CI-Bot' || '' }}
run: |
pytest -n 2 --dist=loadfile -v --make-reports=${{ matrix.modules }}_tests_cpu ${{ fromJson(needs.setup_pr_tests.outputs.test_map)[matrix.modules] }}
pytest -n 2 --dist=loadfile -m "${{ matrix.markers }}" --make-reports=${{ matrix.name }}_tests_cpu ${{ matrix.paths }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible to include a comment to show example markers and name?

If possible, I would also increase the number of workers to 4. Doesn't hurt I guess.


- name: Failure short reports
if: ${{ failure() }}
continue-on-error: true
run: |
cat reports/${{ matrix.modules }}_tests_cpu_stats.txt
cat reports/${{ matrix.modules }}_tests_cpu_failures_short.txt
cat reports/${{ matrix.name }}_tests_cpu_stats.txt
cat reports/${{ matrix.name }}_tests_cpu_failures_short.txt

- name: Test suite reports artifacts
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.modules }}_test_reports
name: ${{ matrix.name }}_test_reports

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're still not fetching the GPU tests for new pipeline PRs? For example, on MiniMax H3 Image (it's not limited to MiniMax H3 Image), I had to trigger the fast GPU tests manually. This should not be the case right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the changes here are specifically for CPU PR tests. GPU test support will be added in a follow up.

path: reports

run_staging_tests:
Expand Down
19 changes: 18 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,29 @@ extend-exclude = [
[tool.ruff.lint]
# Never enforce `E501` (line length violations).
ignore = ["C901", "E501", "E721", "E741", "F402", "F823"]
select = ["C", "E", "F", "I", "W"]
select = ["C", "E", "F", "I", "W", "TID251"]

# `utils/tests_fetcher.py` selects the tests a PR runs from the import graph. `auto_pipeline.py` imports every

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it interfere with the actual testing of the auto pipelines? For example, if a PR concerns auto pipelines, how does the fetcher react to it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the actual auto-pipeline test we ignore this rule:
https://github.com/huggingface/diffusers/pull/14607/changes#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R26

A PR touching auto_pipeline.py selects tests/pipelines/test_pipelines_auto.py, since it is the only test file importing the AutoPipeline object now.

# pipeline, so a test that imports an AutoPipeline is selected on every pipeline change. Tests use the concrete
# pipeline class instead; the auto pipelines' own test is the one exception.
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"diffusers.AutoPipelineForText2Image".msg = "AutoPipeline imports are not allowed in tests because they interfere with the test fetcher's selection logic. Use the specific pipeline class instead (e.g. `FluxPipeline`)."
"diffusers.AutoPipelineForImage2Image".msg = "AutoPipeline imports are not allowed in tests because they interfere with the test fetcher's selection logic. Use the specific pipeline class instead (e.g. `FluxPipeline`)."
"diffusers.AutoPipelineForInpainting".msg = "AutoPipeline imports are not allowed in tests because they interfere with the test fetcher's selection logic. Use the specific pipeline class instead (e.g. `FluxPipeline`)."
"diffusers.AutoPipelineForText2Audio".msg = "AutoPipeline imports are not allowed in tests because they interfere with the test fetcher's selection logic. Use the specific pipeline class instead (e.g. `FluxPipeline`)."

# Ignore import violations in all `__init__.py` files.
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401", "F403", "F811"]
"src/diffusers/utils/dummy_*.py" = ["F401"]
# The AutoPipeline ban only concerns test selection; everything outside tests/ may use them.
"tests/pipelines/test_pipelines_auto.py" = ["TID251"]
"src/**" = ["TID251"]
"examples/**" = ["TID251"]
"benchmarks/**" = ["TID251"]
"scripts/**" = ["TID251"]
"utils/**" = ["TID251"]
"docs/**" = ["TID251"]

[tool.ruff.lint.isort]
lines-after-imports = 2
Expand Down
60 changes: 60 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import ast
import sys
import warnings
from os.path import abspath, dirname, join

import pytest


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
Expand All @@ -30,7 +33,49 @@
warnings.simplefilter(action="ignore", category=FutureWarning)


def marker_decorators():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider providing an example of how a minimal decorators would look like.

"""Map each `is_*` decorator in `tests/testing_utils.py` to the pytest marker it applies.

Only that file is read: it is where the marker decorators are defined. The `testing_utils/` packages
under `tests/models/` and `tests/pipelines/` hold the tester mixins that *use* these decorators, and the
per-pipeline `testing_utils.py` files hold test helpers; neither defines markers. Read from the source
with `ast` rather than imported, so `utils/tests_fetcher.py` can call this without importing torch.
Matches `def is_x(test_case): return pytest.mark.<marker>(test_case)`, so with

def is_lora(test_case):
return pytest.mark.lora(test_case)

def is_torch_compile(test_case):
return pytest.mark.compile(test_case)

in `tests/testing_utils.py` the result is `{"is_lora": "lora", "is_torch_compile": "compile"}`. A new `is_*`
decorator is picked up automatically; nothing else needs registering.
"""
tree = ast.parse(open(join(dirname(__file__), "testing_utils.py"), encoding="utf-8").read())
decorators = {}
for node in ast.walk(tree):
if not isinstance(node, ast.FunctionDef) or not node.name.startswith("is_"):
continue
for ret in ast.walk(node):
if isinstance(ret, ast.Return) and isinstance(ret.value, ast.Call):
func = ret.value.func
if (
isinstance(func, ast.Attribute)
and isinstance(func.value, ast.Attribute)
and func.value.attr == "mark"
):
decorators[node.name] = func.attr
return decorators


# Every marker an `is_*` decorator applies takes a test out of the `core` set. CI runs each feature in its
# own job (`-m lora`, ...) and everything else as `-m core`, so a test carrying none of these is marked
# `core` at collection time. `utils/tests_fetcher.py` uses the same set to decide which jobs to schedule.
NON_CORE_MARKERS = set(marker_decorators().values())


def pytest_configure(config):
config.addinivalue_line("markers", "core: marks tests carrying none of the feature markers (added automatically)")
config.addinivalue_line("markers", "big_accelerator: marks tests as requiring big accelerator resources")
config.addinivalue_line("markers", "lora: marks tests for LoRA/PEFT functionality")
config.addinivalue_line("markers", "ip_adapter: marks tests for IP Adapter functionality")
Expand All @@ -54,6 +99,21 @@ def pytest_configure(config):
config.addinivalue_line("markers", "nightly: mark test as nightly")


@pytest.hookimpl(tryfirst=True)
def pytest_collection_modifyitems(items):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a hook that marks any test without an explicit feature marker as is_core.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the corresponding test could be a non-core. Just trying to understand situations where this might be helpful.

I also don't see it used anywhere in the changeset of the PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative is to manually mark core tests. The risk there is that if we miss marking tests, then core functionality would be untested.

With this approach, if non-core tests happen to fall into core, we've just run a few extra tests vs skipping. I also think this is less likely to happen after the tests refactor, because the feature marker system is quite comprehensive.

This is how we apply core.

  1. Based on the diff, we fetch the relevant test files
  2. Extract the tester Mixins from the files and determine which test markers to fetch.
  3. Files are grouped by top-level tests/ folder. tests/models and tests/pipelines are split further into one job per feature group (lora, attention, memory, etc), plus a core job for the tests without a marker. This is done in utils/tests_fetcher.py here and is always added to model and pipeline tests.
  4. This matrix is what the CI workflow consumes.

Example matrix:

[
  {
    "name": "others",
    "paths": "tests/others/test_flashpack.py",
    "markers": ""
  },
  {
    "name": "pipelines-core",
    "paths": "tests/pipelines/kandinsky3/test_kandinsky3.py tests/pipelines/kandinsky3/test_kandinsky3_img2img.py tests/pipelines/pag/test_pag_sd.py tests/pipelines/pag/test_pag_sd3_img2img.py tests/pipelines/pag/test_pag_sd_img2img.py tests/pipelines/pag/test_pag_sd_inpaint.py tests/pipelines/pag/test_pag_sdxl.py tests/pipelines/pag/test_pag_sdxl_img2img.py tests/pipelines/pag/test_pag_sdxl_inpaint.py tests/pipelines/stable_diffusion/test_stable_diffusion.py tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl.py",
    "markers": "core"
  },
  {
    "name": "pipelines-lora",
    "paths": "<same 11 files>",
    "markers": "lora"
  },
  {
    "name": "pipelines-memory",
    "paths": "<same 11 files>",
    "markers": "memory or cpu_offload or group_offload"
  },
  {
    "name": "pipelines-ip_adapter",
    "paths": "<same 11 files>",
    "markers": "ip_adapter"
  }
]

A sample run:
https://github.com/huggingface/diffusers/actions/runs/42666762892

"""Mark every test carrying none of `NON_CORE_MARKERS` as `core`.

CI runs the feature jobs with `-m lora`, `-m memory`, ... and everything else with `-m core`. A positive
marker is the only way to say "everything else" to pytest: `-m "not (lora or memory or ...)"` would have
to list every feature marker and silently go stale. Adding the marker here, to every collected test
without a feature marker, keeps `core` exhaustive by construction. `tryfirst` runs this before pytest's
own `-m` deselection, which happens in the same hook.
"""
for item in items:
if not any(m.name in NON_CORE_MARKERS for m in item.iter_markers()):
item.add_marker("core")


def pytest_addoption(parser):
from .testing_utils import pytest_addoption_shared

Expand Down
6 changes: 3 additions & 3 deletions tests/others/test_flashpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import pytest

from diffusers import AutoPipelineForText2Image
from diffusers import FluxPipeline
from diffusers.models.auto_model import AutoModel

from ..testing_utils import is_torch_available, require_flashpack, require_torch_gpu
Expand All @@ -40,11 +40,11 @@ def test_save_load_model(self, tmp_path):

@require_flashpack
def test_save_load_pipeline(self, tmp_path):
pipeline = AutoPipelineForText2Image.from_pretrained(self.model_id)
pipeline = FluxPipeline.from_pretrained(self.model_id)
pipeline.save_pretrained(tmp_path, use_flashpack=True)
assert (tmp_path / "transformer" / "model.flashpack").exists()
assert (tmp_path / "vae" / "model.flashpack").exists()
pipeline = AutoPipelineForText2Image.from_pretrained(tmp_path, use_flashpack=True)
pipeline = FluxPipeline.from_pretrained(tmp_path, use_flashpack=True)

@require_torch_gpu
@require_flashpack
Expand Down
7 changes: 3 additions & 4 deletions tests/pipelines/kandinsky3/test_kandinsky3.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
from transformers import AutoConfig, AutoTokenizer, T5EncoderModel

from diffusers import (
AutoPipelineForImage2Image,
AutoPipelineForText2Image,
Comment on lines -25 to -26

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's then better to replace them with their exact pipeline class so that we don't have to do the inline import. Doing it this way also preserves the expected behaviour in the dependency map? Applies elsewhere, too.

Kandinsky3Img2ImgPipeline,
Kandinsky3Pipeline,
Kandinsky3UNet,
VQModel,
Expand Down Expand Up @@ -177,7 +176,7 @@ def cleanup(self):
backend_empty_cache(torch_device)

def test_kandinskyV3(self):
pipe = AutoPipelineForText2Image.from_pretrained(
pipe = Kandinsky3Pipeline.from_pretrained(
"kandinsky-community/kandinsky-3", variant="fp16", torch_dtype=torch.float16
)
pipe.enable_model_cpu_offload(device=torch_device)
Expand All @@ -203,7 +202,7 @@ def test_kandinskyV3(self):
assert np.allclose(image_np, expected_image_np, atol=5e-2)

def test_kandinskyV3_img2img(self):
pipe = AutoPipelineForImage2Image.from_pretrained(
pipe = Kandinsky3Img2ImgPipeline.from_pretrained(
"kandinsky-community/kandinsky-3", variant="fp16", torch_dtype=torch.float16
)
pipe.enable_model_cpu_offload(device=torch_device)
Expand Down
3 changes: 1 addition & 2 deletions tests/pipelines/kandinsky3/test_kandinsky3_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from transformers import AutoConfig, AutoTokenizer, T5EncoderModel

from diffusers import (
AutoPipelineForImage2Image,
Kandinsky3Img2ImgPipeline,
Kandinsky3UNet,
VQModel,
Expand Down Expand Up @@ -192,7 +191,7 @@ def cleanup(self):
backend_empty_cache(torch_device)

def test_kandinskyV3_img2img(self):
pipe = AutoPipelineForImage2Image.from_pretrained(
pipe = Kandinsky3Img2ImgPipeline.from_pretrained(
"kandinsky-community/kandinsky-3", variant="fp16", torch_dtype=torch.float16
)
pipe.enable_model_cpu_offload(device=torch_device)
Expand Down
5 changes: 2 additions & 3 deletions tests/pipelines/pag/test_pag_sd.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from diffusers import (
AutoencoderKL,
AutoPipelineForText2Image,
DDIMScheduler,
StableDiffusionPAGPipeline,
StableDiffusionPipeline,
Expand Down Expand Up @@ -253,7 +252,7 @@ def get_inputs(self, device, generator_device="cpu", seed=1, guidance_scale=7.0)
return inputs

def test_pag_cfg(self):
pipeline = AutoPipelineForText2Image.from_pretrained(self.repo_id, enable_pag=True, torch_dtype=torch.float16)
pipeline = StableDiffusionPAGPipeline.from_pretrained(self.repo_id, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload(device=torch_device)
pipeline.set_progress_bar_config(disable=None)

Expand All @@ -271,7 +270,7 @@ def test_pag_cfg(self):
)

def test_pag_uncond(self):
pipeline = AutoPipelineForText2Image.from_pretrained(self.repo_id, enable_pag=True, torch_dtype=torch.float16)
pipeline = StableDiffusionPAGPipeline.from_pretrained(self.repo_id, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload(device=torch_device)
pipeline.set_progress_bar_config(disable=None)

Expand Down
9 changes: 4 additions & 5 deletions tests/pipelines/pag/test_pag_sd3_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from diffusers import (
AutoencoderKL,
AutoPipelineForImage2Image,
FlowMatchEulerDiscreteScheduler,
SD3Transformer2DModel,
StableDiffusion3Img2ImgPipeline,
Expand Down Expand Up @@ -196,8 +195,8 @@ def get_inputs(
return inputs

def test_pag_cfg(self):
pipeline = AutoPipelineForImage2Image.from_pretrained(
self.repo_id, enable_pag=True, torch_dtype=torch.float16, pag_applied_layers=["blocks.17"]
pipeline = StableDiffusion3PAGImg2ImgPipeline.from_pretrained(
self.repo_id, torch_dtype=torch.float16, pag_applied_layers=["blocks.17"]
)
pipeline.enable_model_cpu_offload(device=torch_device)
pipeline.set_progress_bar_config(disable=None)
Expand All @@ -224,8 +223,8 @@ def test_pag_cfg(self):
)

def test_pag_uncond(self):
pipeline = AutoPipelineForImage2Image.from_pretrained(
self.repo_id, enable_pag=True, torch_dtype=torch.float16, pag_applied_layers=["blocks.(4|17)"]
pipeline = StableDiffusion3PAGImg2ImgPipeline.from_pretrained(
self.repo_id, torch_dtype=torch.float16, pag_applied_layers=["blocks.(4|17)"]
)
pipeline.enable_model_cpu_offload(device=torch_device)
pipeline.set_progress_bar_config(disable=None)
Expand Down
5 changes: 2 additions & 3 deletions tests/pipelines/pag/test_pag_sd_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from diffusers import (
AutoencoderKL,
AutoPipelineForImage2Image,
EulerDiscreteScheduler,
StableDiffusionImg2ImgPipeline,
StableDiffusionPAGImg2ImgPipeline,
Expand Down Expand Up @@ -197,7 +196,7 @@ def get_inputs(self, device, generator_device="cpu", dtype=torch.float32, seed=0
return inputs

def test_pag_cfg(self):
pipeline = AutoPipelineForImage2Image.from_pretrained(self.repo_id, enable_pag=True, torch_dtype=torch.float16)
pipeline = StableDiffusionPAGImg2ImgPipeline.from_pretrained(self.repo_id, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload(device=torch_device)
pipeline.set_progress_bar_config(disable=None)

Expand All @@ -215,7 +214,7 @@ def test_pag_cfg(self):
)

def test_pag_uncond(self):
pipeline = AutoPipelineForImage2Image.from_pretrained(self.repo_id, enable_pag=True, torch_dtype=torch.float16)
pipeline = StableDiffusionPAGImg2ImgPipeline.from_pretrained(self.repo_id, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload(device=torch_device)
pipeline.set_progress_bar_config(disable=None)

Expand Down
5 changes: 2 additions & 3 deletions tests/pipelines/pag/test_pag_sd_inpaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

from diffusers import (
AutoencoderKL,
AutoPipelineForInpainting,
PNDMScheduler,
StableDiffusionInpaintPipeline,
StableDiffusionPAGInpaintPipeline,
Expand Down Expand Up @@ -275,7 +274,7 @@ def get_inputs(self, device, generator_device="cpu", seed=0, guidance_scale=7.0)
return inputs

def test_pag_cfg(self):
pipeline = AutoPipelineForInpainting.from_pretrained(self.repo_id, enable_pag=True, torch_dtype=torch.float16)
pipeline = StableDiffusionPAGInpaintPipeline.from_pretrained(self.repo_id, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload(device=torch_device)
pipeline.set_progress_bar_config(disable=None)

Expand All @@ -293,7 +292,7 @@ def test_pag_cfg(self):
)

def test_pag_uncond(self):
pipeline = AutoPipelineForInpainting.from_pretrained(self.repo_id, enable_pag=True, torch_dtype=torch.float16)
pipeline = StableDiffusionPAGInpaintPipeline.from_pretrained(self.repo_id, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload(device=torch_device)
pipeline.set_progress_bar_config(disable=None)

Expand Down
Loading
Loading