Skip to content

Commit 53ba24b

Browse files
committed
scale_noise->add_noise
1 parent 6e5341b commit 53ba24b

10 files changed

+20
-20
lines changed

examples/community/pipeline_flux_differential_img2img.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ def prepare_latents(
582582

583583
if latents is None:
584584
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
585-
latents = self.scheduler.scale_noise(image_latents, timestep, noise)
585+
latents = self.scheduler.add_noise(image_latents, noise, timestep)
586586
else:
587587
noise = latents.to(device)
588588
latents = noise
@@ -976,8 +976,8 @@ def __call__(
976976

977977
if i < len(timesteps) - 1:
978978
noise_timestep = timesteps[i + 1]
979-
image_latent = self.scheduler.scale_noise(
980-
original_image_latents, torch.tensor([noise_timestep]), noise
979+
image_latent = self.scheduler.add_noise(
980+
original_image_latents, noise, torch.tensor([noise_timestep])
981981
)
982982

983983
# start diff diff

examples/community/pipeline_stable_diffusion_3_differential_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ def prepare_latents(
640640
shape = init_latents.shape
641641
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
642642

643-
init_latents = self.scheduler.scale_noise(init_latents, timestep, noise)
643+
init_latents = self.scheduler.add_noise(init_latents, noise, timestep)
644644
latents = init_latents.to(device=device, dtype=dtype)
645645

646646
return latents

src/diffusers/pipelines/flux/pipeline_flux_control_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def prepare_latents(
580580
image_latents = torch.cat([image_latents], dim=0)
581581

582582
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
583-
latents = self.scheduler.scale_noise(image_latents, timestep, noise)
583+
latents = self.scheduler.add_noise(image_latents, noise, timestep)
584584
latents = self._pack_latents(latents, batch_size, num_channels_latents, height, width)
585585
return latents, latent_image_ids
586586

src/diffusers/pipelines/flux/pipeline_flux_control_inpaint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ def prepare_latents(
646646
image_latents = torch.cat([image_latents], dim=0)
647647

648648
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
649-
latents = self.scheduler.scale_noise(image_latents, timestep, noise)
649+
latents = self.scheduler.add_noise(image_latents, noise, timestep)
650650
latents = self._pack_latents(latents, batch_size, num_channels_latents, height, width)
651651
return latents, noise, image_latents, latent_image_ids
652652

@@ -1091,8 +1091,8 @@ def __call__(
10911091
init_mask = mask
10921092
if i < len(timesteps) - 1:
10931093
noise_timestep = timesteps[i + 1]
1094-
init_latents_proper = self.scheduler.scale_noise(
1095-
image_latents, torch.tensor([noise_timestep]), noise
1094+
init_latents_proper = self.scheduler.add_noise(
1095+
image_latents, noise, torch.tensor([noise_timestep])
10961096
)
10971097
else:
10981098
init_latents_proper = image_latents

src/diffusers/pipelines/flux/pipeline_flux_controlnet_image_to_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def prepare_latents(
579579
image_latents = torch.cat([image_latents], dim=0)
580580

581581
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
582-
latents = self.scheduler.scale_noise(image_latents, timestep, noise)
582+
latents = self.scheduler.add_noise(image_latents, noise, timestep)
583583
latents = self._pack_latents(latents, batch_size, num_channels_latents, height, width)
584584
return latents, latent_image_ids
585585

src/diffusers/pipelines/flux/pipeline_flux_controlnet_inpainting.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def prepare_latents(
605605

606606
if latents is None:
607607
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
608-
latents = self.scheduler.scale_noise(image_latents, timestep, noise)
608+
latents = self.scheduler.add_noise(image_latents, noise, timestep)
609609
else:
610610
noise = latents.to(device)
611611
latents = noise
@@ -1159,8 +1159,8 @@ def __call__(
11591159

11601160
if i < len(timesteps) - 1:
11611161
noise_timestep = timesteps[i + 1]
1162-
init_latents_proper = self.scheduler.scale_noise(
1163-
init_latents_proper, torch.tensor([noise_timestep]), noise
1162+
init_latents_proper = self.scheduler.add_noise(
1163+
init_latents_proper, noise, torch.tensor([noise_timestep])
11641164
)
11651165

11661166
latents = (1 - init_mask) * init_latents_proper + init_mask * latents

src/diffusers/pipelines/flux/pipeline_flux_inpaint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ def prepare_latents(
582582

583583
if latents is None:
584584
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
585-
latents = self.scheduler.scale_noise(image_latents, timestep, noise)
585+
latents = self.scheduler.add_noise(image_latents, noise, timestep)
586586
else:
587587
noise = latents.to(device)
588588
latents = noise
@@ -977,8 +977,8 @@ def __call__(
977977

978978
if i < len(timesteps) - 1:
979979
noise_timestep = timesteps[i + 1]
980-
init_latents_proper = self.scheduler.scale_noise(
981-
init_latents_proper, torch.tensor([noise_timestep]), noise
980+
init_latents_proper = self.scheduler.add_noise(
981+
init_latents_proper, noise, torch.tensor([noise_timestep])
982982
)
983983

984984
latents = (1 - init_mask) * init_latents_proper + init_mask * latents

src/diffusers/pipelines/pag/pipeline_pag_sd_3_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ def prepare_latents(self, image, timestep, batch_size, num_images_per_prompt, dt
702702
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
703703

704704
# get latents
705-
init_latents = self.scheduler.scale_noise(init_latents, timestep, noise)
705+
init_latents = self.scheduler.add_noise(init_latents, noise, timestep)
706706
latents = init_latents.to(device=device, dtype=dtype)
707707

708708
return latents

src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_img2img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ def prepare_latents(self, image, timestep, batch_size, num_images_per_prompt, dt
708708
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
709709

710710
# get latents
711-
init_latents = self.scheduler.scale_noise(init_latents, timestep, noise)
711+
init_latents = self.scheduler.add_noise(init_latents, noise, timestep)
712712
latents = init_latents.to(device=device, dtype=dtype)
713713

714714
return latents

src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_inpaint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ def prepare_latents(
717717
if latents is None:
718718
noise = randn_tensor(shape, generator=generator, device=device, dtype=dtype)
719719
# if strength is 1. then initialise the latents to noise, else initial to image + noise
720-
latents = noise if is_strength_max else self.scheduler.scale_noise(image_latents, timestep, noise)
720+
latents = noise if is_strength_max else self.scheduler.add_noise(image_latents, noise, timestep)
721721
else:
722722
noise = latents.to(device)
723723
latents = noise
@@ -1203,8 +1203,8 @@ def __call__(
12031203

12041204
if i < len(timesteps) - 1:
12051205
noise_timestep = timesteps[i + 1]
1206-
init_latents_proper = self.scheduler.scale_noise(
1207-
init_latents_proper, torch.tensor([noise_timestep]), noise
1206+
init_latents_proper = self.scheduler.add_noise(
1207+
init_latents_proper, noise, torch.tensor([noise_timestep])
12081208
)
12091209

12101210
latents = (1 - init_mask) * init_latents_proper + init_mask * latents

0 commit comments

Comments
 (0)