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