smoothieAI commited on
Commit
15ab9bf
·
verified ·
1 Parent(s): 189f975

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +7 -1
pipeline.py CHANGED
@@ -1058,6 +1058,10 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1058
  noise_pred_text = noise_pred_text[:, :, :-wrap_count, :, :]
1059
  noise_pred_uncond_sum[:, :, current_context_start : current_context_start + context_size, :, :] += noise_pred_uncond
1060
  noise_pred_text_sum[:, :, current_context_start : current_context_start + context_size, :, :] += noise_pred_text
 
 
 
 
1061
 
1062
  # set the step index to the current batch
1063
  self.scheduler._step_index = i
@@ -1065,12 +1069,14 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1065
  # perform guidance
1066
  if do_classifier_free_guidance:
1067
  latent_counter = latent_counter.reshape(1, 1, num_frames, 1, 1)
 
1068
  noise_pred_uncond = noise_pred_uncond_sum / latent_counter
1069
  noise_pred_text = noise_pred_text_sum / latent_counter
1070
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1071
-
1072
  # compute the previous noisy sample x_t -> x_t-1
1073
  latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample
 
1074
 
1075
  # call the callback, if provided
1076
  if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):
 
1058
  noise_pred_text = noise_pred_text[:, :, :-wrap_count, :, :]
1059
  noise_pred_uncond_sum[:, :, current_context_start : current_context_start + context_size, :, :] += noise_pred_uncond
1060
  noise_pred_text_sum[:, :, current_context_start : current_context_start + context_size, :, :] += noise_pred_text
1061
+
1062
+ # print min and max values of noise_pred_uncond_sum and noise_pred_text_sum
1063
+ print(f"noise_pred_uncond_sum min: {noise_pred_uncond_sum.min()} max: {noise_pred_uncond_sum.max()}")
1064
+ print(f"noise_pred_text_sum min: {noise_pred_text_sum.min()} max: {noise_pred_text_sum.max()}")
1065
 
1066
  # set the step index to the current batch
1067
  self.scheduler._step_index = i
 
1069
  # perform guidance
1070
  if do_classifier_free_guidance:
1071
  latent_counter = latent_counter.reshape(1, 1, num_frames, 1, 1)
1072
+ print(f"latent_counter min: {latent_counter.min()} max: {latent_counter.max()}")
1073
  noise_pred_uncond = noise_pred_uncond_sum / latent_counter
1074
  noise_pred_text = noise_pred_text_sum / latent_counter
1075
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
1076
+
1077
  # compute the previous noisy sample x_t -> x_t-1
1078
  latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample
1079
+ print(f"latents min: {latents.min()} max: {latents.max()}")
1080
 
1081
  # call the callback, if provided
1082
  if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):