-
Notifications
You must be signed in to change notification settings - Fork 7.2k
tests: fix cuda model tests. #14464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: fix cuda model tests. #14464
Changes from all commits
c916ed9
f20ff93
518c706
6b9dfcb
08b15b2
1705e7d
d623186
3ac527a
4c54567
7b76841
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,8 +25,8 @@ | |
| BaseModelTesterConfig, | ||
| MemoryTesterMixin, | ||
| ModelTesterMixin, | ||
| TorchCompileTesterMixin, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not common to run compilation tests for autoencoders.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| TrainingTesterMixin, | ||
| run_nondeterministic, | ||
| ) | ||
| from .testing_utils import NewAutoencoderTesterMixin | ||
|
|
||
|
|
@@ -134,6 +134,18 @@ def test_encode_decode_temporal_geometry(self): | |
| class TestAutoencoderKLMiniMaxH3Memory(AutoencoderKLMiniMaxH3TesterConfig, MemoryTesterMixin): | ||
| """Memory optimization tests for the MiniMax-H3 video autoencoder.""" | ||
|
|
||
| @pytest.mark.skip( | ||
| "`_keep_in_fp32_modules` pins every module of this autoencoder, so layerwise casting has nothing to cast and " | ||
| "the memory footprint does not change." | ||
| ) | ||
| def test_layerwise_casting_memory(self): | ||
| pass | ||
|
|
||
| # The encoder's reflect spatial padding has no deterministic CUDA backward | ||
| # (reflection_pad3d_backward_out_cuda), so every test with a backward pass runs with determinism relaxed. | ||
| def test_layerwise_casting_training(self): | ||
| run_nondeterministic(super().test_layerwise_casting_training) | ||
|
|
||
|
|
||
| class TestAutoencoderKLMiniMaxH3Training(AutoencoderKLMiniMaxH3TesterConfig, TrainingTesterMixin): | ||
| """Training tests for the MiniMax-H3 video autoencoder.""" | ||
|
|
@@ -143,13 +155,23 @@ def test_gradient_checkpointing_is_applied(self): | |
| expected_set={"MiniMaxH3VideoDownBlock3d", "MiniMaxH3VideoViTDecoder3d"} | ||
| ) | ||
|
|
||
| # The encoder's reflect spatial padding has no deterministic CUDA backward | ||
| # (reflection_pad3d_backward_out_cuda), so every test with a backward pass runs with determinism relaxed. | ||
| def test_training(self): | ||
| run_nondeterministic(super().test_training) | ||
|
|
||
| class TestAutoencoderKLMiniMaxH3Attention(AutoencoderKLMiniMaxH3TesterConfig, AttentionTesterMixin): | ||
| """Attention processor tests for the MiniMax-H3 video autoencoder.""" | ||
| def test_training_with_ema(self): | ||
| run_nondeterministic(super().test_training_with_ema) | ||
|
|
||
| def test_mixed_precision_training(self): | ||
| run_nondeterministic(super().test_mixed_precision_training) | ||
|
|
||
| class TestAutoencoderKLMiniMaxH3TorchCompile(AutoencoderKLMiniMaxH3TesterConfig, TorchCompileTesterMixin): | ||
| """Torch compile tests for the MiniMax-H3 video autoencoder.""" | ||
| def test_gradient_checkpointing_equivalence(self): | ||
| run_nondeterministic(super().test_gradient_checkpointing_equivalence) | ||
|
|
||
|
|
||
| class TestAutoencoderKLMiniMaxH3Attention(AutoencoderKLMiniMaxH3TesterConfig, AttentionTesterMixin): | ||
| """Attention processor tests for the MiniMax-H3 video autoencoder.""" | ||
|
|
||
|
|
||
| class TestAutoencoderKLMiniMaxH3SlicingTiling(AutoencoderKLMiniMaxH3TesterConfig, NewAutoencoderTesterMixin): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For running AOT tests in our CI:
https://github.com/huggingface/diffusers/actions/runs/31722536141