Spaces:
Sleeping
Sleeping
Update pk_workflow.py
Browse files353 unmodified lines35435535635735835936057 unmodified lines418419420421422423424127 unmodified lines552553554555556557353 unmodified linesdenoised = sample + sigma_from_timestep * model_outputcompute_dtype = torch.float32 if sample.dtype in (torch.float16, torch.bfloat16) else sample.dtypesigmas = scheduler.sigmas.to(device=sample.device, dtype=compute_dtype)sigma, sigma_next = sigmas[i], sigmas[i + 1]x = sample.to(dtype=compute_dtype)denoised = denoised.to(dtype=compute_dtype)57 unmodified linesdenoised = sample + sigma_from_timestep * model_outputcompute_dtype = torch.float32 if sample.dtype in (torch.float16, torch.bfloat16) else sample.dtypesigmas = scheduler.sigmas.to(device=sample.device, dtype=compute_dtype)sigma, sigma_next = sigmas[i], sigmas[i + 1]x = sample.to(dtype=compute_dtype)denoised = denoised.to(dtype=compute_dtype)127 unmodified linesscheduler._dpmpp_sde_h_last = Nonescheduler._dpmpp_sde_h_last_2 = Nonescheduler._dpmpp_sde_noise_sampler = Nonescheduler._dpmpp_sde_seed = self.seed + offsetdef stepped(model_output, timestep, sample, return_dict=True, _s=scheduler, _f=step_fn, **_kwargs):353 unmodified lines35435535635735835936036136236336436557 unmodified lines423424425426427428429430431432433434127 unmodified lines562563564565566567568353 unmodified linesdenoised = sample + sigma_from_timestep * model_outputcompute_dtype = torch.float32 if sample.dtype in (torch.float16, torch.bfloat16) else sample.dtype# Cached once and reused every call — `torchsde.BrownianTree` caches its internal tree keyed to the exact# float value it was first queried with, and re-deriving "the same" sigma via a fresh `.to()` cast on a# later call can land a few ULPs away from what the tree remembers, which it treats as an ordering error.if scheduler._dpmpp_sde_sigmas is None:scheduler._dpmpp_sde_sigmas = scheduler.sigmas.to(device=sample.device, dtype=compute_dtype)sigmas = scheduler._dpmpp_sde_sigmassigma, sigma_next = sigmas[i], sigmas[i + 1]x = sample.to(dtype=compute_dtype)denoised = denoised.to(dtype=compute_dtype)57 unmodified linesdenoised = sample + sigma_from_timestep * model_outputcompute_dtype = torch.float32 if sample.dtype in (torch.float16, torch.bfloat16) else sample.dtype# Cached once and reused every call — `torchsde.BrownianTree` caches its internal tree keyed to the exact# float value it was first queried with, and re-deriving "the same" sigma via a fresh `.to()` cast on a# later call can land a few ULPs away from what the tree remembers, which it treats as an ordering error.if scheduler._dpmpp_sde_sigmas is None:scheduler._dpmpp_sde_sigmas = scheduler.sigmas.to(device=sample.device, dtype=compute_dtype)sigmas = scheduler._dpmpp_sde_sigmassigma, sigma_next = sigmas[i], sigmas[i + 1]x = sample.to(dtype=compute_dtype)denoised = denoised.to(dtype=compute_dtype)127 unmodified linesscheduler._dpmpp_sde_h_last = Nonescheduler._dpmpp_sde_h_last_2 = Nonescheduler._dpmpp_sde_noise_sampler = Nonescheduler._dpmpp_sde_sigmas = Nonescheduler._dpmpp_sde_seed = self.seed + offsetdef stepped(model_output, timestep, sample, return_dict=True, _s=scheduler, _f=step_fn, **_kwargs):
pk_workflow.py+13-2