Skip to content

[tests] fix SVD tests - #14687

Merged
sayakpaul merged 2 commits into
mainfrom
svd-test-fixes
Sep 2, 2026
Merged

[tests] fix SVD tests#14687
sayakpaul merged 2 commits into
mainfrom
svd-test-fixes

Conversation

@sayakpaul

@sayakpaul sayakpaul commented Sep 2, 2026

Copy link
Copy Markdown
Member

Fixes https://github.com/huggingface/diffusers/actions/runs/33510236955/job/99864282042

It never showed up because we didn't do testing of the corresponding features in the previous testing mixins. I didn't want to touch the src during my refactors of the test suites for a better reviewing experience.

@github-actions github-actions Bot added pipelines size/S PR with diff < 50 LOC labels Sep 2, 2026
@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/pipelines/stable_video_diffusion/

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

pytest tests/pipelines/stable_video_diffusion/ passed on GPU — view logs.

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sayakpaul
sayakpaul requested review from DN6 and dg845 September 2, 2026 05:20
Comment on lines +246 to +247
# The image comes out of `video_processor.preprocess()` in float32, so it has to follow the VAE dtype.
# `needs_upcasting` in `__call__` has already moved a float16 VAE to float32 by this point.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this comment is confusing because the change addresses the needs_upcasting=False case, not the needs_upcasting=True case (where both the image and vae would be in FP32 and we wouldn't need to cast). So we should rewrite it or remove it.

(needs_upcasting only checks whether the VAE dtype is FP16, which seems like a bug. The tests in https://github.com/huggingface/diffusers/actions/runs/33510236955/job/99864282042 fail when the input is BF16.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think this comment is confusing because the change addresses the needs_upcasting=False case, not the needs_upcasting=True case (where both the image and vae would be in FP32 and we wouldn't need to cast). So we should rewrite it or remove it.

But the current change would still remain agnostic to it because we're casting to the dtype of the VAE no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So maybe a better comment is:

# The image comes out of `video_processor.preprocess()` in float32, so it has to follow the VAE dtype.
# `needs_upcasting=False` in `__call__` has already moved a float16 VAE to float32 by this point. But regardless of that, this change should be harmless.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

(needs_upcasting only checks whether the VAE dtype is FP16, which seems like a bug.

I don't think it's a bug, actually. The underlying VAE from the pretrained SVD checkpoint is very sensitive to FP16, so it has historical reasons. So you might remember: https://huggingface.co/madebyollin/sdxl-vae-fp16-fix

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think the current change still makes sense regardless. I would suggest something like

# The image comes out of `video_processor.preprocess()` in float32. When `needs_upcasting=False`, the VAE may not
# be in FP32 (for example, it could be in BF16) so we need to cast in this case.

@dg845 dg845 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! Left one comment.

@sayakpaul
sayakpaul merged commit 260a33d into main Sep 2, 2026
15 of 16 checks passed
@sayakpaul
sayakpaul deleted the svd-test-fixes branch September 2, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pipelines size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants