smoothieAI commited on
Commit
1a81101
·
verified ·
1 Parent(s): e46e7d3

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +5 -0
pipeline.py CHANGED
@@ -1497,9 +1497,14 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1497
 
1498
  if do_classifier_free_guidance:
1499
  # Split tensor along its first dimension
 
1500
  time_chunk = time.time()
 
1501
  noise_pred_uncond, noise_pred_text = torch.chunk(noise_pred, 2, dim=0)
 
 
1502
  print("chunk time", time.time() - time_chunk)
 
1503
  for i, context_index in enumerate(current_context_indexes):
1504
  # Perform batch addition
1505
  noise_pred_uncond_sum[..., context_index, :, :] += noise_pred_uncond[:, :, i, :, :]
 
1497
 
1498
  if do_classifier_free_guidance:
1499
  # Split tensor along its first dimension
1500
+ torch.cuda.synchronize() # Synchronize GPU before starting timing
1501
  time_chunk = time.time()
1502
+
1503
  noise_pred_uncond, noise_pred_text = torch.chunk(noise_pred, 2, dim=0)
1504
+
1505
+ torch.cuda.synchronize() # Synchronize GPU after operation
1506
  print("chunk time", time.time() - time_chunk)
1507
+
1508
  for i, context_index in enumerate(current_context_indexes):
1509
  # Perform batch addition
1510
  noise_pred_uncond_sum[..., context_index, :, :] += noise_pred_uncond[:, :, i, :, :]