dagloop5 commited on
Commit
c95bf71
·
verified ·
1 Parent(s): 8bd0f00

Update h3_dpmpp_2s_ancestral.py

Browse files
Files changed (1) hide show
  1. h3_dpmpp_2s_ancestral.py +17 -2
h3_dpmpp_2s_ancestral.py CHANGED
@@ -411,13 +411,28 @@ class MiniMaxH3DPMppSdeStep(ModularPipelineBlocks):
411
  # Lazily built on the first step, same lifetime as the request (this block instance is discarded
412
  # after) — the real, un-nudged schedule bounds are the tree's span; per-step nudging happens
413
  # only in the query sigmas passed to it, same convention `_dpmpp_2m_sde_step` already uses.
 
 
 
 
 
 
 
 
 
 
 
414
  video_sigmas = components.scheduler.sigmas.to(device=x_video.device, dtype=compute_dtype)
415
  audio_sigmas = components.audio_scheduler.sigmas.to(device=x_audio.device, dtype=compute_dtype)
 
 
 
 
416
  self._video_noise_sampler = _BrownianTreeNoiseSampler(
417
- x_video_c, video_sigmas[video_sigmas > 0].min(), video_sigmas.max(), seed=self.seed, cpu=False
418
  )
419
  self._audio_noise_sampler = _BrownianTreeNoiseSampler(
420
- x_audio_c, audio_sigmas[audio_sigmas > 0].min(), audio_sigmas.max(), seed=self.seed + 1, cpu=False
421
  )
422
 
423
  u_video, sigma_s_video, sigma_i_dpm_video, lambda_s_video = _dpmpp_sde_gpu_prepare(
 
411
  # Lazily built on the first step, same lifetime as the request (this block instance is discarded
412
  # after) — the real, un-nudged schedule bounds are the tree's span; per-step nudging happens
413
  # only in the query sigmas passed to it, same convention `_dpmpp_2m_sde_step` already uses.
414
+ #
415
+ # `cpu=True`, not `cpu=False` — despite the earlier claim here that `cpu=False` "matches the
416
+ # `*_gpu` sampler names," `_dpmpp_2m_sde_step`/`_dpmpp_3m_sde_step` (both also `*_gpu`-suffixed)
417
+ # deliberately use `cpu=True`, precisely because `torchsde.BrownianTree`'s recursive bisection is
418
+ # latency-bound, sequential work that GPU kernel-launch overhead tends to make *slower* on-device
419
+ # than on CPU, not faster — the opposite of what the name suggests. This was very likely the
420
+ # actual cause of `dpmpp_sde_gpu` losing a same-cost (two-eval-per-step) race to `seeds_2`.
421
+ #
422
+ # Padded a hair beyond the real [min, max] span too, matching `_dpmpp_2m_sde_step`'s fix for the
423
+ # same reason: querying a BrownianTree exactly on its own construction bound is a known torchsde
424
+ # precision edge (`tb<=t1`-style warnings) that this class never picked up when it was written.
425
  video_sigmas = components.scheduler.sigmas.to(device=x_video.device, dtype=compute_dtype)
426
  audio_sigmas = components.audio_scheduler.sigmas.to(device=x_audio.device, dtype=compute_dtype)
427
+ video_min, video_max = video_sigmas[video_sigmas > 0].min(), video_sigmas.max()
428
+ audio_min, audio_max = audio_sigmas[audio_sigmas > 0].min(), audio_sigmas.max()
429
+ video_pad = (video_max - video_min).clamp_min(1e-6) * 1e-4
430
+ audio_pad = (audio_max - audio_min).clamp_min(1e-6) * 1e-4
431
  self._video_noise_sampler = _BrownianTreeNoiseSampler(
432
+ x_video_c, video_min - video_pad, video_max + video_pad, seed=self.seed, cpu=True
433
  )
434
  self._audio_noise_sampler = _BrownianTreeNoiseSampler(
435
+ x_audio_c, audio_min - audio_pad, audio_max + audio_pad, seed=self.seed + 1, cpu=True
436
  )
437
 
438
  u_video, sigma_s_video, sigma_i_dpm_video, lambda_s_video = _dpmpp_sde_gpu_prepare(