mirror of
https://github.com/huggingface/diffusers.git
synced 2026-01-27 17:22:53 +03:00
Remove duplicate add_noise
This commit is contained in:
@@ -130,14 +130,5 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
|
||||
noisy_samples = (alpha_prod**0.5) * original_samples + ((1 - alpha_prod) ** 0.5) * noise
|
||||
return noisy_samples
|
||||
|
||||
def add_noise(self, original_samples, noise, timesteps):
|
||||
sqrt_alpha_prod = self.alphas_cumprod[timesteps] ** 0.5
|
||||
sqrt_alpha_prod = self.match_shape(sqrt_alpha_prod, original_samples)
|
||||
sqrt_one_minus_alpha_prod = (1 - self.alphas_cumprod[timesteps]) ** 0.5
|
||||
sqrt_one_minus_alpha_prod = self.match_shape(sqrt_one_minus_alpha_prod, original_samples)
|
||||
|
||||
noisy_samples = sqrt_alpha_prod * original_samples + sqrt_one_minus_alpha_prod * noise
|
||||
return noisy_samples
|
||||
|
||||
def __len__(self):
|
||||
return self.config.num_train_timesteps
|
||||
|
||||
@@ -28,12 +28,12 @@ from .import_utils import (
|
||||
DummyObject,
|
||||
is_flax_available,
|
||||
is_inflect_available,
|
||||
is_modelcards_available,
|
||||
is_scipy_available,
|
||||
is_tf_available,
|
||||
is_torch_available,
|
||||
is_transformers_available,
|
||||
is_unidecode_available,
|
||||
is_modelcards_available,
|
||||
requires_backends,
|
||||
)
|
||||
from .logging import get_logger
|
||||
|
||||
Reference in New Issue
Block a user