Skip to content

tests: fix cuda model tests. - #14464

Open
sayakpaul wants to merge 10 commits into
mainfrom
fix-cuda-model-tests
Open

tests: fix cuda model tests.#14464
sayakpaul wants to merge 10 commits into
mainfrom
fix-cuda-model-tests

Conversation

@sayakpaul

@sayakpaul sayakpaul commented Aug 13, 2026

Copy link
Copy Markdown
Member

Fix: https://github.com/huggingface/diffusers/actions/runs/31675311029/job/94368495140 and https://github.com/huggingface/diffusers/actions/runs/31675311029/job/94368495111.

I have individually verified that the test files being changed in this PR are now running successfully on our CI (as seen in the bot invocations below).

@github-actions github-actions Bot added models tests size/M PR with diff < 200 LOC labels Aug 13, 2026
@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.

BaseModelTesterConfig,
MemoryTesterMixin,
ModelTesterMixin,
TorchCompileTesterMixin,

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.

Not common to run compilation tests for autoencoders.

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 we should consider having compilation tests for autoencoders in general (although maybe there's a good reason not to that I'm not aware of).

@sayakpaul sayakpaul Aug 15, 2026

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.

Encoders and decoders are typically run only once and hence it doesn't make much sense to use compile and any potential latency improvements we might get from them. We can consider case by case and see if they deliver (i.e., a compile decode) a significant speedup but that is a separate PR. The exception here is if a decode (and encode) uses attention backends like Flex, then we must compile; otherwise it will be terribly slow and might even lead to OOMs.

Same reason why we don't typically compile the text encoder (or anything other than the denoiser for that matter).

I hope this makes sense. Thanks for asking the question.

# the runtime base image only ships the libraries.
RUN apt install -y bash \
build-essential \
cuda-cudart-dev-12-9 \

@sayakpaul sayakpaul Aug 13, 2026

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.

@sayakpaul

Copy link
Copy Markdown
Member Author

PEFT related failures are reported in huggingface/peft#3548

@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/models/autoencoders/test_models_autoencoder_kl_kvae_video.py

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

pytest tests/models/autoencoders/test_models_autoencoder_kl_kvae_video.py passed on GPU — view logs.

@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/models/autoencoders/test_models_autoencoder_kl_minimax_h3.py

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

pytest tests/models/autoencoders/test_models_autoencoder_kl_minimax_h3.py passed on GPU — view logs.

@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/models/autoencoders/test_models_autoencoder_kl_minimax_h3_audio.py

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

pytest tests/models/autoencoders/test_models_autoencoder_kl_minimax_h3_audio.py passed on GPU — view logs.

@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/models/autoencoders/test_models_autoencoder_vidtok.py

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

pytest tests/models/autoencoders/test_models_autoencoder_vidtok.py passed on GPU — view logs.

@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/models/transformers/test_models_transformer_cosmos3.py

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

pytest tests/models/transformers/test_models_transformer_cosmos3.py failed on GPU — view logs.

@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/models/transformers/test_models_transformer_z_image.py

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

pytest tests/models/transformers/test_models_transformer_z_image.py passed on GPU — view logs.

@sayakpaul
sayakpaul requested review from DN6 and dg845 August 13, 2026 19:42
@sayakpaul
sayakpaul marked this pull request as ready for review August 13, 2026 19:42
Comment thread tests/models/testing_utils/utils.py Outdated
Comment thread src/diffusers/models/transformers/transformer_minimax_h3.py Outdated

@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! I think we should also consider fixing other failing tests in the modified model test files. If I test locally with a CUDA device, I get the following test failures:

  1. test_model_parallelism
    1. Minimax H3 video VAE: TestAutoencoderKLMiniMaxH3.test_model_parallelism
    2. Cosmos 3 transformer: TestCosmos3OmniTransformerModel.test_model_parallelism
    3. Z-Image transformer: TestZImageTransformer.test_model_parallelism

@sayakpaul

Copy link
Copy Markdown
Member Author

@dg845 I have replied to / addressed your comments. The parallelism failures target more than one GPUs, so, I will fix it in a follow-up.

@sayakpaul

Copy link
Copy Markdown
Member Author

/diffusers-bot pytest tests/models/autoencoders/test_models_autoencoder_kl_kvae_video.py tests/models/autoencoders/test_models_autoencoder_kl_minimax_h3.py tests/models/autoencoders/test_models_autoencoder_kl_minimax_h3_audio.py tests/models/autoencoders/test_models_autoencoder_vidtok.py tests/models/transformers/test_models_transformer_cosmos3.py tests/models/transformers/test_models_transformer_z_image.py

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

pytest tests/models/autoencoders/test_models_autoencoder_kl_kvae_video.py tests/models/autoencoders/test_models_autoencoder_kl_minimax_h3.py tests/models/autoencoders/test_models_autoencoder_kl_minimax_h3_audio.py tests/models/autoencoders/test_models_autoencoder_vidtok.py tests/models/transformers/test_models_transformer_cosmos3.py tests/models/transformers/test_models_transformer_z_image.py failed on GPU — view logs.

@sayakpaul
sayakpaul requested a review from dg845 August 15, 2026 05:45
@sayakpaul

Copy link
Copy Markdown
Member Author

The failing tests are related to AOT which are being fixed in this PR. The problem is that the Docker container the runner used was overwritten using the Dockerfile from main. Hence, I triggered another Docker build and push (from this branch): https://github.com/huggingface/diffusers/actions/runs/31868022007. That should fix things.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

models size/M PR with diff < 200 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants