smoothieAI commited on
Commit
2e9eb8e
·
verified ·
1 Parent(s): f668249

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +8 -2
pipeline.py CHANGED
@@ -1428,7 +1428,10 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1428
 
1429
 
1430
  if self.controlnet != None and i < int(control_end*len(timesteps)):
1431
- contorl_start = time.time()
 
 
 
1432
  current_context_conditioning_frames = conditioning_frames[current_context_indexes, :, :, :]
1433
  current_context_conditioning_frames = torch.cat([current_context_conditioning_frames] * 2) if do_classifier_free_guidance else current_context_conditioning_frames
1434
 
@@ -1467,8 +1470,10 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1467
  guess_mode=guess_mode,
1468
  return_dict=False,
1469
  )
1470
- print("controlnet time", time.time() - contorl_start)
1471
 
 
 
 
1472
  unet_start = time.time()
1473
  # predict the noise residual with the added controlnet residuals
1474
  noise_pred = self.unet(
@@ -1480,6 +1485,7 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
1480
  down_block_additional_residuals=down_block_res_samples,
1481
  mid_block_additional_residual=mid_block_res_sample,
1482
  ).sample
 
1483
  print("unet time", time.time() - unet_start)
1484
 
1485
  else:
 
1428
 
1429
 
1430
  if self.controlnet != None and i < int(control_end*len(timesteps)):
1431
+
1432
+ torch.cuda.synchronize() # Synchronize GPU
1433
+ control_start = time.time()
1434
+
1435
  current_context_conditioning_frames = conditioning_frames[current_context_indexes, :, :, :]
1436
  current_context_conditioning_frames = torch.cat([current_context_conditioning_frames] * 2) if do_classifier_free_guidance else current_context_conditioning_frames
1437
 
 
1470
  guess_mode=guess_mode,
1471
  return_dict=False,
1472
  )
 
1473
 
1474
+ torch.cuda.synchronize() # Synchronize GPU
1475
+ print("controlnet time", time.time() - control_start)
1476
+ torch.cuda.synchronize()
1477
  unet_start = time.time()
1478
  # predict the noise residual with the added controlnet residuals
1479
  noise_pred = self.unet(
 
1485
  down_block_additional_residuals=down_block_res_samples,
1486
  mid_block_additional_residual=mid_block_res_sample,
1487
  ).sample
1488
+ torch.cuda.synchronize()
1489
  print("unet time", time.time() - unet_start)
1490
 
1491
  else: