Update pipeline.py
Browse files- pipeline.py +13 -8
pipeline.py
CHANGED
@@ -1006,17 +1006,22 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
|
|
1006 |
noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
|
1007 |
noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
|
1008 |
|
1009 |
-
#
|
1010 |
-
current_context_latents = self.scheduler.step(noise_pred, t, current_context_latents, **extra_step_kwargs).prev_sample
|
1011 |
-
|
1012 |
-
# if context_start + context_size > num_frames: remove the appended frames from the end of the current_context_latents
|
1013 |
if wrap_count > 0:
|
1014 |
-
# add the ending frames from current_context_latents to the start of the latent_sum
|
1015 |
-
latent_sum[:, :, 0:wrap_count, :, :] += current_context_latents[:, :, -wrap_count:, :, :]
|
1016 |
-
# increase the counter for the ending frames
|
1017 |
-
latent_counter[0:wrap_count] += 1
|
1018 |
# remove the ending frames from current_context_latents
|
1019 |
current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1020 |
|
1021 |
#add the context current_context_latents back to the latent sum starting from the current context start
|
1022 |
latent_sum[:, :, current_context_start : current_context_start + context_size, :, :] += current_context_latents
|
|
|
1006 |
noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
|
1007 |
noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
|
1008 |
|
1009 |
+
# remove the appended frames from the end of the current_context_latents
|
|
|
|
|
|
|
1010 |
if wrap_count > 0:
|
|
|
|
|
|
|
|
|
1011 |
# remove the ending frames from current_context_latents
|
1012 |
current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
|
1013 |
+
|
1014 |
+
# compute the previous noisy sample x_t -> x_t-1
|
1015 |
+
current_context_latents = self.scheduler.step(noise_pred, t, current_context_latents, **extra_step_kwargs).prev_sample
|
1016 |
+
|
1017 |
+
# # if context_start + context_size > num_frames: remove the appended frames from the end of the current_context_latents
|
1018 |
+
# if wrap_count > 0:
|
1019 |
+
# # add the ending frames from current_context_latents to the start of the latent_sum
|
1020 |
+
# latent_sum[:, :, 0:wrap_count, :, :] += current_context_latents[:, :, -wrap_count:, :, :]
|
1021 |
+
# # increase the counter for the ending frames
|
1022 |
+
# latent_counter[0:wrap_count] += 1
|
1023 |
+
# # remove the ending frames from current_context_latents
|
1024 |
+
# current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
|
1025 |
|
1026 |
#add the context current_context_latents back to the latent sum starting from the current context start
|
1027 |
latent_sum[:, :, current_context_start : current_context_start + context_size, :, :] += current_context_latents
|