Skip to content

Commit af95be6

Browse files
sywangyisayakpaul
andauthored
Fix Wan and Motif video pipeline fast test failures (#14269)
* Fix Wan and Motif video pipeline fast test failures Description This PR fixes several failing fast tests for Motif Video and Wan pipelines. Changes Updated test_motif_video.py to use a Motif-specific fp16 save/load tolerance. T5Gemma2Encoder rebuilds non-persistent RoPE buffers after save/load, which introduces small fp16 numerical drift. The test now keeps coverage while allowing this expected drift. Updated transformer_wan.py to keep Wan RoPE modules in fp32 during mixed precision handling. This avoids fp16 precision drift in Wan save/load paths. Updated memory.py group offloading coverage to include transformer_2 and skip None optional components. This fixes Wan 2.2 memory/offloading tests where optional secondary transformers may be absent. Updated stale expected slices in test_wan_image_to_video.py for: TestWanImageToVideoPipeline::test_inference TestWanFLFToVideoPipeline::test_inference Signed-off-by: Wang, Yi A <yi.a.wang@intel.com> * revert change in test_wan_image_to_video.py Signed-off-by: Wang, Yi A <yi.a.wang@intel.com> --------- Signed-off-by: Wang, Yi A <yi.a.wang@intel.com> Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
1 parent 4d89a88 commit af95be6

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/diffusers/models/transformers/transformer_wan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ class WanTransformer3DModel(
546546
_supports_gradient_checkpointing = True
547547
_skip_layerwise_casting_patterns = ["patch_embedding", "condition_embedder", "norm"]
548548
_no_split_modules = ["WanTransformerBlock"]
549-
_keep_in_fp32_modules = ["time_embedder", "scale_shift_table", "norm1", "norm2", "norm3"]
549+
_keep_in_fp32_modules = ["rope", "time_embedder", "scale_shift_table", "norm1", "norm2", "norm3"]
550550
_keys_to_ignore_on_load_unexpected = ["norm_added_q"]
551551
_repeated_blocks = ["WanTransformerBlock"]
552552
_cp_plan = {

tests/pipelines/motif_video/test_motif_video.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,7 @@ def test_inference(self):
141141
generated_video = video[0]
142142

143143
self.assertEqual(generated_video.shape, (9, 16, 16, 3))
144+
145+
def test_save_load_float16(self):
146+
# T5Gemma2Encoder rebuilds non-persistent RoPE buffers after save/load, which causes small fp16 drift.
147+
super().test_save_load_float16(expected_max_diff=5e-2)

tests/pipelines/testing_utils/memory.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,15 @@ def enable_group_offload_on_component(pipe, group_offloading_kwargs):
288288
"text_encoder_2",
289289
"text_encoder_3",
290290
"transformer",
291+
"transformer_2",
291292
"unet",
292293
"controlnet",
293294
]:
294295
if not hasattr(pipe, component_name):
295296
continue
296297
component = getattr(pipe, component_name)
298+
if component is None:
299+
continue
297300
if not getattr(component, "_supports_group_offloading", True):
298301
continue
299302
if hasattr(component, "enable_group_offload"):

0 commit comments

Comments
 (0)