[BugFix]: Fixed add_noise in LMSDiscreteScheduler (#253)
* Fixed add_noise in LMSDiscreteScheduler * Linting * Update src/diffusers/schedulers/scheduling_lms_discrete.py Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com> Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com>
This commit is contained in:
parent
9e1b1ca49d
commit
da7d4cf200
|
@ -124,10 +124,8 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
|
||||||
return {"prev_sample": prev_sample}
|
return {"prev_sample": prev_sample}
|
||||||
|
|
||||||
def add_noise(self, original_samples, noise, timesteps):
|
def add_noise(self, original_samples, noise, timesteps):
|
||||||
alpha_prod = self.alphas_cumprod[timesteps]
|
sigmas = self.match_shape(self.sigmas, noise)
|
||||||
alpha_prod = self.match_shape(alpha_prod, original_samples)
|
noisy_samples = original_samples + noise * sigmas[timesteps]
|
||||||
|
|
||||||
noisy_samples = (alpha_prod**0.5) * original_samples + ((1 - alpha_prod) ** 0.5) * noise
|
|
||||||
return noisy_samples
|
return noisy_samples
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
|
|
Loading…
Reference in New Issue