smoothieAI commited on
Commit
dd283e2
·
verified ·
1 Parent(s): 26ad6f1

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +12 -23
pipeline.py CHANGED
@@ -1006,36 +1006,25 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1006
  # set the step index to the current batch
1007
  self.scheduler._step_index = i
1008
 
1009
- print(f"current_context_latents shape: {current_context_latents.shape}")
1010
- print(f"noise_pred shape: {noise_pred.shape}")
1011
-
1012
-
1013
- # print size of sigmas
1014
- print(f"sigma len: {len(self.scheduler.sigmas)}")
1015
-
1016
- # print step index
1017
- print(f"step index: {self.scheduler.step_index}")
1018
- print(f"sigma: {self.scheduler.sigmas[self.scheduler.step_index + 1]}")
1019
-
1020
  # compute the previous noisy sample x_t -> x_t-1
1021
  current_context_latents = self.scheduler.step(noise_pred, t, current_context_latents, **extra_step_kwargs).prev_sample
1022
 
1023
  # remove the appended frames from the end of the current_context_latents
1024
- if wrap_count > 0:
1025
- # remove the ending frames from current_context_latents
1026
- current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
1027
- # remove the ending frames from noise_pred
1028
- noise_pred = noise_pred[:, :, :-wrap_count, :, :]
1029
- # print the shape of the current_context_latents and noise_pred
1030
-
1031
- # # if context_start + context_size > num_frames: remove the appended frames from the end of the current_context_latents
1032
  # if wrap_count > 0:
1033
- # # add the ending frames from current_context_latents to the start of the latent_sum
1034
- # latent_sum[:, :, 0:wrap_count, :, :] += current_context_latents[:, :, -wrap_count:, :, :]
1035
- # # increase the counter for the ending frames
1036
- # latent_counter[0:wrap_count] += 1
1037
  # # remove the ending frames from current_context_latents
1038
  # current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
 
 
 
 
 
 
 
 
 
 
 
 
1039
 
1040
  #add the context current_context_latents back to the latent sum starting from the current context start
1041
  latent_sum[:, :, current_context_start : current_context_start + context_size, :, :] += current_context_latents
 
1006
  # set the step index to the current batch
1007
  self.scheduler._step_index = i
1008
 
 
 
 
 
 
 
 
 
 
 
 
1009
  # compute the previous noisy sample x_t -> x_t-1
1010
  current_context_latents = self.scheduler.step(noise_pred, t, current_context_latents, **extra_step_kwargs).prev_sample
1011
 
1012
  # remove the appended frames from the end of the current_context_latents
 
 
 
 
 
 
 
 
1013
  # if wrap_count > 0:
 
 
 
 
1014
  # # remove the ending frames from current_context_latents
1015
  # current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
1016
+ # # remove the ending frames from noise_pred
1017
+ # noise_pred = noise_pred[:, :, :-wrap_count, :, :]
1018
+ # # print the shape of the current_context_latents and noise_pred
1019
+
1020
+ # if context_start + context_size > num_frames: remove the appended frames from the end of the current_context_latents
1021
+ if wrap_count > 0:
1022
+ # add the ending frames from current_context_latents to the start of the latent_sum
1023
+ latent_sum[:, :, 0:wrap_count, :, :] += current_context_latents[:, :, -wrap_count:, :, :]
1024
+ # increase the counter for the ending frames
1025
+ latent_counter[0:wrap_count] += 1
1026
+ # remove the ending frames from current_context_latents
1027
+ current_context_latents = current_context_latents[:, :, :-wrap_count, :, :]
1028
 
1029
  #add the context current_context_latents back to the latent sum starting from the current context start
1030
  latent_sum[:, :, current_context_start : current_context_start + context_size, :, :] += current_context_latents