Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/diffusers/models/transformers/transformer_wan_vace.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class WanVACETransformer3DModel(
_supports_gradient_checkpointing = True
_skip_layerwise_casting_patterns = ["patch_embedding", "vace_patch_embedding", "condition_embedder", "norm"]
_no_split_modules = ["WanTransformerBlock", "WanVACETransformerBlock"]
_keep_in_fp32_modules = ["time_embedder", "scale_shift_table", "norm1", "norm2", "norm3"]
_keep_in_fp32_modules = ["rope", "time_embedder", "scale_shift_table", "norm1", "norm2", "norm3"]
_keys_to_ignore_on_load_unexpected = ["norm_added_q"]
_repeated_blocks = ["WanTransformerBlock", "WanVACETransformerBlock"]

Expand Down
1 change: 1 addition & 0 deletions src/diffusers/pipelines/wan/pipeline_wan_video2video.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def prepare_latents(
)

if latents is None:
video = video.to(device=device, dtype=self.vae.dtype)

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.

Mirroring what the rest of the Wan bunch does.

init_latents = [retrieve_latents(self.vae.encode(vid.unsqueeze(0)), sample_mode="argmax") for vid in video]

init_latents = torch.cat(init_latents, dim=0).to(dtype)
Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/chroma/test_pipeline_chroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def get_dummy_components(self, num_layers: int = 1, num_single_layers: int = 1):

torch.manual_seed(0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()

tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/chroma/test_pipeline_chroma_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def get_dummy_components(self, num_layers: int = 1, num_single_layers: int = 1):

torch.manual_seed(0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()

tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/ltx/test_ltx.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ def get_dummy_components(self, num_layers: int = 1):
torch.manual_seed(0)
scheduler = FlowMatchEulerDiscreteScheduler()
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

components = {
Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/ltx/test_ltx_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = FlowMatchEulerDiscreteScheduler()
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

components = {
Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/ltx/test_ltx_image2video.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = FlowMatchEulerDiscreteScheduler()
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

components = {
Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/wan/test_wan.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def get_dummy_components(self):
# TODO: impl FlowDPMSolverMultistepScheduler
scheduler = FlowMatchEulerDiscreteScheduler(shift=7.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down
8 changes: 6 additions & 2 deletions tests/pipelines/wan/test_wan_22.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = UniPCMultistepScheduler(prediction_type="flow_prediction", use_flow_sigmas=True, flow_shift=3.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down Expand Up @@ -191,7 +193,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = UniPCMultistepScheduler(prediction_type="flow_prediction", use_flow_sigmas=True, flow_shift=3.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down
8 changes: 6 additions & 2 deletions tests/pipelines/wan/test_wan_22_image_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = UniPCMultistepScheduler(prediction_type="flow_prediction", use_flow_sigmas=True, flow_shift=3.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down Expand Up @@ -203,7 +205,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = UniPCMultistepScheduler(prediction_type="flow_prediction", use_flow_sigmas=True, flow_shift=3.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/wan/test_wan_animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = FlowMatchEulerDiscreteScheduler(shift=7.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down
8 changes: 6 additions & 2 deletions tests/pipelines/wan/test_wan_image_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def get_dummy_components(self):
# TODO: impl FlowDPMSolverMultistepScheduler
scheduler = FlowMatchEulerDiscreteScheduler(shift=7.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down Expand Up @@ -198,7 +200,9 @@ def get_dummy_components(self):
# TODO: impl FlowDPMSolverMultistepScheduler
scheduler = FlowMatchEulerDiscreteScheduler(shift=7.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/wan/test_wan_vace.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = FlowMatchEulerDiscreteScheduler(shift=7.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down
4 changes: 3 additions & 1 deletion tests/pipelines/wan/test_wan_video_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def get_dummy_components(self):
torch.manual_seed(0)
scheduler = UniPCMultistepScheduler(flow_shift=3.0)
config = AutoConfig.from_pretrained("hf-internal-testing/tiny-random-t5")
text_encoder = T5EncoderModel(config)
# `eval()` because a directly constructed model stays in training mode, which leaves T5's
# dropout active and makes the pipeline outputs non-deterministic across calls.
text_encoder = T5EncoderModel(config).eval()
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-t5")

torch.manual_seed(0)
Expand Down
Loading