Spaces:
Running
on
A10G
Running
on
A10G
Linoy Tsaban
commited on
Commit
•
66aec19
1
Parent(s):
65837e4
Update modified_pipeline_semantic_stable_diffusion.py
Browse files
modified_pipeline_semantic_stable_diffusion.py
CHANGED
@@ -685,10 +685,6 @@ class SemanticStableDiffusionPipeline(DiffusionPipeline):
|
|
685 |
# σ_t = sqrt((1 − α_t−1)/(1 − α_t)) * sqrt(1 − α_t/α_t−1)
|
686 |
# variance = self.scheduler._get_variance(timestep, prev_timestep)
|
687 |
# variance = get_variance(model, t) #, prev_timestep)
|
688 |
-
prev_timestep = t - self.scheduler.config.num_train_timesteps // self.scheduler.num_inference_steps
|
689 |
-
alpha_prod_t = self.scheduler.alphas_cumprod[t]
|
690 |
-
alpha_prod_t_prev = self.scheduler.alphas_cumprod[prev_timestep] if prev_timestep >= 0 else self.scheduler.final_alpha_cumprod
|
691 |
-
beta_prod_t = 1 - alpha_prod_t
|
692 |
beta_prod_t_prev = 1 - alpha_prod_t_prev
|
693 |
variance = (beta_prod_t_prev / beta_prod_t) * (1 - alpha_prod_t / alpha_prod_t_prev)
|
694 |
|
@@ -713,7 +709,7 @@ class SemanticStableDiffusionPipeline(DiffusionPipeline):
|
|
713 |
|
714 |
## ddpm ##########################################################
|
715 |
# compute the previous noisy sample x_t -> x_t-1
|
716 |
-
if not use_ddpm:
|
717 |
latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample
|
718 |
|
719 |
# call the callback, if provided
|
|
|
685 |
# σ_t = sqrt((1 − α_t−1)/(1 − α_t)) * sqrt(1 − α_t/α_t−1)
|
686 |
# variance = self.scheduler._get_variance(timestep, prev_timestep)
|
687 |
# variance = get_variance(model, t) #, prev_timestep)
|
|
|
|
|
|
|
|
|
688 |
beta_prod_t_prev = 1 - alpha_prod_t_prev
|
689 |
variance = (beta_prod_t_prev / beta_prod_t) * (1 - alpha_prod_t / alpha_prod_t_prev)
|
690 |
|
|
|
709 |
|
710 |
## ddpm ##########################################################
|
711 |
# compute the previous noisy sample x_t -> x_t-1
|
712 |
+
else: #if not use_ddpm:
|
713 |
latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample
|
714 |
|
715 |
# call the callback, if provided
|