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

Method __call__

sat/sgm/modules/diffusionmodules/sampling.py:447–476  ·  view source on GitHub ↗
(self, denoiser, image, randn, cond, uc=None, num_steps=None, edit_ratio=None)

Source from the content-addressed store, hash-verified

445 self.edit_ratio = edit_ratio
446
447 def __call__(self, denoiser, image, randn, cond, uc=None, num_steps=None, edit_ratio=None):
448 randn_unit = randn.clone()
449 randn, s_in, sigmas, num_sigmas, cond, uc = self.prepare_sampling_loop(randn, cond, uc, num_steps)
450
451 if num_steps is None:
452 num_steps = self.num_steps
453 if edit_ratio is None:
454 edit_ratio = self.edit_ratio
455 x = None
456
457 for i in self.get_sigma_gen(num_sigmas):
458 if i / num_steps < edit_ratio:
459 continue
460 if x is None:
461 x = image + randn_unit * append_dims(s_in * sigmas[i], len(randn_unit.shape))
462
463 gamma = (
464 min(self.s_churn / (num_sigmas - 1), 2**0.5 - 1) if self.s_tmin <= sigmas[i] <= self.s_tmax else 0.0
465 )
466 x = self.sampler_step(
467 s_in * sigmas[i],
468 s_in * sigmas[i + 1],
469 denoiser,
470 x,
471 cond,
472 uc,
473 gamma,
474 )
475
476 return x
477
478
479class VideoDDIMSampler(BaseDiffusionSampler):

Callers

nothing calls this directly

Calls 4

get_sigma_genMethod · 0.80
append_dimsFunction · 0.50
prepare_sampling_loopMethod · 0.45
sampler_stepMethod · 0.45

Tested by

no test coverage detected