smoothieAI commited on
Commit
6509a00
·
verified ·
1 Parent(s): 041b0a3

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +4 -1
pipeline.py CHANGED
@@ -1417,6 +1417,7 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1417
  # foreach context group seperately denoise the current timestep
1418
  for context_group in range(len(context_indexes[i])):
1419
  # calculate to current indexes, considering overlap
 
1420
  current_context_indexes = context_indexes[i][context_group]
1421
 
1422
  # select the relevent context from the latents
@@ -1425,11 +1426,11 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1425
  # expand the latents if we are doing classifier free guidance
1426
  latent_model_input = torch.cat([current_context_latents] * 2) if do_classifier_free_guidance else current_context_latents
1427
  latent_model_input = self.scheduler.scale_model_input(latent_model_input, t)
 
1428
 
1429
 
1430
  if self.controlnet != None and i < int(control_end*len(timesteps)):
1431
  contorl_start = time.time()
1432
-
1433
  current_context_conditioning_frames = conditioning_frames[current_context_indexes, :, :, :]
1434
  current_context_conditioning_frames = torch.cat([current_context_conditioning_frames] * 2) if do_classifier_free_guidance else current_context_conditioning_frames
1435
 
@@ -1496,6 +1497,7 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1496
  print("unet time", time.time() - unet_start)
1497
 
1498
  # sum the noise predictions for the unconditional and text conditioned noise
 
1499
  if do_classifier_free_guidance:
1500
  noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
1501
 
@@ -1504,6 +1506,7 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1504
  noise_pred_text_sum[:, :,current_context_indexes, :, :] += noise_pred_text
1505
  #increase the counter for the ending frames
1506
  latent_counter[current_context_indexes] += 1
 
1507
 
1508
  # set the step index to the current batch
1509
  self.scheduler._step_index = i
 
1417
  # foreach context group seperately denoise the current timestep
1418
  for context_group in range(len(context_indexes[i])):
1419
  # calculate to current indexes, considering overlap
1420
+ prep_time = time.time()
1421
  current_context_indexes = context_indexes[i][context_group]
1422
 
1423
  # select the relevent context from the latents
 
1426
  # expand the latents if we are doing classifier free guidance
1427
  latent_model_input = torch.cat([current_context_latents] * 2) if do_classifier_free_guidance else current_context_latents
1428
  latent_model_input = self.scheduler.scale_model_input(latent_model_input, t)
1429
+ print("prep time", time.time() - prep_time)
1430
 
1431
 
1432
  if self.controlnet != None and i < int(control_end*len(timesteps)):
1433
  contorl_start = time.time()
 
1434
  current_context_conditioning_frames = conditioning_frames[current_context_indexes, :, :, :]
1435
  current_context_conditioning_frames = torch.cat([current_context_conditioning_frames] * 2) if do_classifier_free_guidance else current_context_conditioning_frames
1436
 
 
1497
  print("unet time", time.time() - unet_start)
1498
 
1499
  # sum the noise predictions for the unconditional and text conditioned noise
1500
+ start_guidance_time = time.time()
1501
  if do_classifier_free_guidance:
1502
  noise_pred_uncond, noise_pred_text = noise_pred.chunk(2)
1503
 
 
1506
  noise_pred_text_sum[:, :,current_context_indexes, :, :] += noise_pred_text
1507
  #increase the counter for the ending frames
1508
  latent_counter[current_context_indexes] += 1
1509
+ print("guidance time", time.time() - start_guidance_time)
1510
 
1511
  # set the step index to the current batch
1512
  self.scheduler._step_index = i