MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / step

Method step

diffsynth/schedulers/continuous_ode.py:21–33  ·  view source on GitHub ↗
(self, model_output, timestep, sample, to_final=False)

Source from the content-addressed store, hash-verified

19
20
21 def step(self, model_output, timestep, sample, to_final=False):
22 timestep_id = torch.argmin((self.timesteps - timestep).abs())
23 sigma = self.sigmas[timestep_id]
24 sample *= (sigma*sigma + 1).sqrt()
25 estimated_sample = -sigma / (sigma*sigma + 1).sqrt() * model_output + 1 / (sigma*sigma + 1) * sample
26 if to_final or timestep_id + 1 >= len(self.timesteps):
27 prev_sample = estimated_sample
28 else:
29 sigma_ = self.sigmas[timestep_id + 1]
30 derivative = 1 / sigma * (sample - estimated_sample)
31 prev_sample = sample + derivative * (sigma_ - sigma)
32 prev_sample /= (sigma_*sigma_ + 1).sqrt()
33 return prev_sample
34
35
36 def return_to_timestep(self, timestep, sample, sample_stablized):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected