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

Method check

diffsynth/pipelines/flashvsr_full.py:476–492  ·  view source on GitHub ↗
(self, dit: WanModel, x, t_mod)

Source from the content-addressed store, hash-verified

474 self.coefficients = self.coefficients_dict[model_id]
475
476 def check(self, dit: WanModel, x, t_mod):
477 modulated_inp = t_mod.clone()
478 if self.step == 0 or self.step == self.num_inference_steps - 1:
479 should_calc = True
480 self.accumulated_rel_l1_distance = 0
481 else:
482 coefficients = self.coefficients
483 rescale_func = np.poly1d(coefficients)
484 self.accumulated_rel_l1_distance += rescale_func(((modulated_inp-self.previous_modulated_input).abs().mean() / self.previous_modulated_input.abs().mean()).cpu().item())
485 should_calc = not (self.accumulated_rel_l1_distance < self.rel_l1_thresh)
486 if should_calc:
487 self.accumulated_rel_l1_distance = 0
488 self.previous_modulated_input = modulated_inp
489 self.step = (self.step + 1) % self.num_inference_steps
490 if should_calc:
491 self.previous_hidden_states = x.clone()
492 return not should_calc
493
494 def store(self, hidden_states):
495 self.previous_residual = hidden_states - self.previous_hidden_states

Callers 1

model_fn_wan_videoFunction · 0.45

Calls 1

cpuMethod · 0.80

Tested by

no test coverage detected