Skip to content

refactor deepfloyd if img2img pipeline tests to the new mixin structure - #14596

Merged
sayakpaul merged 3 commits into
huggingface:mainfrom
akshan-main:refactor-if-img2img-pipeline-tests
Aug 26, 2026
Merged

refactor deepfloyd if img2img pipeline tests to the new mixin structure#14596
sayakpaul merged 3 commits into
huggingface:mainfrom
akshan-main:refactor-if-img2img-pipeline-tests

Conversation

@akshan-main

Copy link
Copy Markdown
Contributor

What does this PR do?

Refactors the DeepFloyd IF img2img pipeline tests to the new mixin structure from #14113, same shape as the text-to-image port: an IFImg2ImgPipelineTesterConfig plus TestIFImg2ImgPipeline(PipelineTesterMixin) and TestIFImg2ImgPipelineMemory(PipelineOffloadTesterMixin), slow class ported to pytest, dummy components inlined from the shared package mixin, and a fresh CPU slice in test_inference.

The same verified choices as #14580 apply: @skip_mps kept (all-NaN output on mps), latents dropped from optional_input_params, the custom test_save_load_optional_components ported (prompt pre-encoded), the obsolete save_load_local override dropped, and the float16 1e-1 tolerance kept. The old test_float16_inference override maps to the framework's test_half_precision_inference_no_nan, which needs no tolerance. Follows #14580.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Did you read our philosophy doc (important for complex PRs)?
  • Was this discussed/approved via a GitHub issue or the forum? Discussed on Slack with @sayakpaul
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

@sayakpaul

@github-actions github-actions Bot added tests size/L PR with diff > 200 LOC labels Aug 24, 2026
Comment on lines +151 to +152
# Due to non-determinism in save load of the hf-internal-testing/tiny-random-t5 text encoder
super().test_save_load_float16(tmp_path, expected_max_diff=1e-1)

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 if we load it using eval() it should be fine? Could we check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right. The old base test ran the fresh components in train mode, so the tiny-random-t5 dropout was the "non-determinism"; the new get_pipeline() puts both sides in eval. Replicated the save/load flow on CPU fp32: eval both sides gives max_diff 1.7e-5, the train-mode first pipe gives 0.94. Dropped the override here and in #14580.

@sayakpaul sayakpaul left a comment

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.

Thanks. Left one comment.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @akshan-main, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice.

Once the PR links an issue (or gets the no-issue-needed label), you can ignore this message — it stays here as a comment, but it no longer applies.

@github-actions github-actions Bot added size/M PR with diff < 200 LOC and removed size/L PR with diff > 200 LOC labels Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M PR with diff < 200 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants