Skip to content

[tests] fix autoencoderdc ml training fix.#14129

Merged
sayakpaul merged 2 commits into
mainfrom
mp-training-autoencoderdc-fix
Jul 7, 2026
Merged

[tests] fix autoencoderdc ml training fix.#14129
sayakpaul merged 2 commits into
mainfrom
mp-training-autoencoderdc-fix

Conversation

@sayakpaul

Copy link
Copy Markdown
Member

No description provided.

@sayakpaul sayakpaul requested a review from dg845 July 6, 2026 03:50
@github-actions github-actions Bot added size/S PR with diff < 50 LOC tests labels Jul 6, 2026
Comment on lines +213 to +215
if torch.device(torch_device).type == "cuda" and not torch.cuda.is_bf16_supported(
including_emulation=False
):

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.

Why do we need to use including_emulation=False here? My understanding is that this will cause the test to be skipped on older CUDA devices for which BF16 is not natively supported but could be emulated, but I'm not sure whether "emulation but no native support" implies that BF16 training is not supported.

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.

The default is_bf16_supported() only verifies that a bf16 tensor can be constructed on the device (that's the emulation fallback in the torch source) — it doesn't guarantee op coverage.

Emulated bf16 covers some cases like storage, casting, etc. but cuDNN has no bf16 convolution engines on compute capability < 8.0, and autocast routes convs to cuDNN in bf16. This is what happened in https://github.com/huggingface/diffusers/actions/runs/28765062110/job/85287707829?pr=14113.

including_emulation=False reduces to a compute-capability ≥ 8.0 check, which matches where cuDNN bf16 support actually begins — so for conv models, "emulated but not native" does mean bf16 autocast training doesn't work.

@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 for the PR! Left one comment.

@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/models/autoencoders/test_models_autoencoder_dc.py::TestAutoencoderDCTraining::test_mixed_precision_training

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

pytest tests/models/autoencoders/test_models_autoencoder_dc.py::TestAutoencoderDCTraining::test_mixed_precision_training passed on GPU — view logs.

@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!

@sayakpaul sayakpaul merged commit 3017d88 into main Jul 7, 2026
14 of 16 checks passed
@sayakpaul sayakpaul deleted the mp-training-autoencoderdc-fix branch July 7, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR with diff < 50 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants