MCPcopy
hub / github.com/zai-org/CogVideo / sampler_step

Method sampler_step

sat/sgm/modules/diffusionmodules/sampling.py:134–142  ·  view source on GitHub ↗
(self, sigma, next_sigma, denoiser, x, cond, uc=None, s_noise=0.0)

Source from the content-addressed store, hash-verified

132 self.s_noise = s_noise
133
134 def sampler_step(self, sigma, next_sigma, denoiser, x, cond, uc=None, s_noise=0.0):
135 denoised = self.denoise(x, denoiser, sigma, cond, uc)
136 d = to_d(x, sigma, denoised)
137 dt = append_dims(next_sigma * (1 - s_noise**2) ** 0.5 - sigma, x.ndim)
138
139 euler_step = x + dt * d + s_noise * append_dims(next_sigma, x.ndim) * torch.randn_like(x)
140
141 x = self.possible_correction_step(euler_step, x, d, dt, next_sigma, denoiser, cond, uc)
142 return x
143
144 def __call__(self, denoiser, x, cond, uc=None, num_steps=None):
145 x, s_in, sigmas, num_sigmas, cond, uc = self.prepare_sampling_loop(x, cond, uc, num_steps)

Callers 1

__call__Method · 0.95

Calls 4

to_dFunction · 0.85
append_dimsFunction · 0.50
denoiseMethod · 0.45

Tested by

no test coverage detected