From f23386835ebdafa89e410302ffee788b8dbfb98b Mon Sep 17 00:00:00 2001 From: Muyang Li Date: Sat, 11 Jan 2025 17:17:41 -0500 Subject: [PATCH] Use `randn_tensor` to replace `torch.randn` `torch.randn` requires `generator` and `latents` on the same device, while the wrapped function `randn_tensor` does not have this issue. --- src/diffusers/pipelines/ltx/pipeline_ltx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffusers/pipelines/ltx/pipeline_ltx.py b/src/diffusers/pipelines/ltx/pipeline_ltx.py index c49918cb7d21..e04290b45754 100644 --- a/src/diffusers/pipelines/ltx/pipeline_ltx.py +++ b/src/diffusers/pipelines/ltx/pipeline_ltx.py @@ -769,7 +769,7 @@ def __call__( if not self.vae.config.timestep_conditioning: timestep = None else: - noise = torch.randn(latents.shape, generator=generator, device=device, dtype=latents.dtype) + noise = randn_tensor(latents.shape, generator=generator, device=device, dtype=latents.dtype) if not isinstance(decode_timestep, list): decode_timestep = [decode_timestep] * batch_size if decode_noise_scale is None: