smoothieAI commited on
Commit
1919538
·
verified ·
1 Parent(s): d5e969e

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +12 -11
pipeline.py CHANGED
@@ -999,20 +999,21 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
999
  if do_classifier_free_guidance:
1000
  noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
1001
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1002
-
1003
- # # remove the appended frames from the end of the current_context_latents
1004
- # if wrap_count > 0:
1005
- # # remove the ending frames from current_context_latents
1006
- # current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
1007
- # # remove the ending frames from noise_pred
1008
- # noise_pred = noise_pred[:, :, :-wrap_count, :, :]
1009
- # # print the shape of the current_context_latents and noise_pred
1010
- # print(f"current_context_latents shape: {current_context_latents.shape}")
1011
- # print(f"noise_pred shape: {noise_pred.shape}")
1012
-
1013
  # compute the previous noisy sample x_t -> x_t-1
1014
  current_context_latents = self.scheduler.step(noise_pred, t, current_context_latents, **extra_step_kwargs).prev_sample
1015
 
 
 
 
 
 
 
 
 
 
 
 
1016
  # # if context_start + context_size > num_frames: remove the appended frames from the end of the current_context_latents
1017
  # if wrap_count > 0:
1018
  # # add the ending frames from current_context_latents to the start of the latent_sum
 
999
  if do_classifier_free_guidance:
1000
  noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
1001
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1002
+
 
 
 
 
 
 
 
 
 
 
1003
  # compute the previous noisy sample x_t -> x_t-1
1004
  current_context_latents = self.scheduler.step(noise_pred, t, current_context_latents, **extra_step_kwargs).prev_sample
1005
 
1006
+
1007
+ # remove the appended frames from the end of the current_context_latents
1008
+ if wrap_count > 0:
1009
+ # remove the ending frames from current_context_latents
1010
+ current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
1011
+ # remove the ending frames from noise_pred
1012
+ noise_pred = noise_pred[:, :, :-wrap_count, :, :]
1013
+ # print the shape of the current_context_latents and noise_pred
1014
+ print(f"current_context_latents shape: {current_context_latents.shape}")
1015
+ print(f"noise_pred shape: {noise_pred.shape}")
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