From 3a38d0141488f8eb1313da1adb7edb12fe9c77d0 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:02:41 +0200 Subject: [PATCH] Allow using precalculated noise only when denoise is 1.0 for now --- pipeline_cogvideox.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pipeline_cogvideox.py b/pipeline_cogvideox.py index 235fe2f..e8512cb 100644 --- a/pipeline_cogvideox.py +++ b/pipeline_cogvideox.py @@ -196,7 +196,7 @@ class CogVideoXPipeline(DiffusionPipeline, CogVideoXLoraLoaderMixin): noise[:, place_idx:place_idx + delta, :, :, :] = noise[:, list_idx, :, :, :] if latents is None: latents = noise.to(device) - else: + elif denoise_strength < 1.0: latents = latents.to(device) timesteps, num_inference_steps = self.get_timesteps(num_inference_steps, denoise_strength, device) latent_timestep = timesteps[:1] @@ -213,6 +213,8 @@ class CogVideoXPipeline(DiffusionPipeline, CogVideoXLoraLoaderMixin): latents = latents[:, :frames_needed, :, :, :] latents = self.scheduler.add_noise(latents, noise.to(device), latent_timestep) + else: + latents = latents.to(device) latents = latents * self.scheduler.init_noise_sigma # scale the initial noise by the standard deviation required by the scheduler return latents, timesteps