|
16 | 16 | import unittest |
17 | 17 |
|
18 | 18 | import torch |
| 19 | +from parameterized import parameterized |
19 | 20 | from transformers import AutoTokenizer, T5EncoderModel |
20 | 21 |
|
21 | 22 | from diffusers import AutoencoderKLMochi, FlowMatchEulerDiscreteScheduler, MochiPipeline, MochiTransformer3DModel |
22 | | -from diffusers.utils.testing_utils import ( |
23 | | - floats_tensor, |
24 | | - require_peft_backend, |
25 | | - skip_mps, |
26 | | -) |
| 23 | +from diffusers.utils.testing_utils import floats_tensor, require_peft_backend, skip_mps |
27 | 24 |
|
28 | 25 |
|
29 | 26 | sys.path.append(".") |
@@ -102,8 +99,21 @@ def get_dummy_inputs(self, with_generator=True): |
102 | 99 | def test_simple_inference_with_text_lora_denoiser_fused_multi(self): |
103 | 100 | super().test_simple_inference_with_text_lora_denoiser_fused_multi(expected_atol=9e-3) |
104 | 101 |
|
105 | | - def test_simple_inference_with_text_denoiser_lora_unfused(self): |
106 | | - super().test_simple_inference_with_text_denoiser_lora_unfused(expected_atol=9e-3) |
| 102 | + @parameterized.expand( |
| 103 | + [ |
| 104 | + # Test actions on text_encoder LoRA only |
| 105 | + ("fused", "text_encoder_only"), |
| 106 | + ("unloaded", "text_encoder_only"), |
| 107 | + ("save_load", "text_encoder_only"), |
| 108 | + # Test actions on both text_encoder and denoiser LoRA |
| 109 | + ("fused", "text_and_denoiser"), |
| 110 | + ("unloaded", "text_and_denoiser"), |
| 111 | + ("unfused", "text_and_denoiser"), |
| 112 | + ("save_load", "text_and_denoiser"), |
| 113 | + ] |
| 114 | + ) |
| 115 | + def test_lora_actions(self, action, components_to_add): |
| 116 | + super().test_lora_actions(action, components_to_add, expected_atol=9e-3) |
107 | 117 |
|
108 | 118 | @unittest.skip("Not supported in Mochi.") |
109 | 119 | def test_simple_inference_with_text_denoiser_block_scale(self): |
|
0 commit comments