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

Method check

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

Source from the content-addressed store, hash-verified

458 self.coefficients = self.coefficients_dict[model_id]
459
460 def check(self, dit: WanModel, x, t_mod):
461 modulated_inp = t_mod.clone()
462 if self.step == 0 or self.step == self.num_inference_steps - 1:
463 should_calc = True
464 self.accumulated_rel_l1_distance = 0
465 else:
466 coefficients = self.coefficients
467 rescale_func = np.poly1d(coefficients)
468 self.accumulated_rel_l1_distance += rescale_func(((modulated_inp-self.previous_modulated_input).abs().mean() / self.previous_modulated_input.abs().mean()).cpu().item())
469 should_calc = not (self.accumulated_rel_l1_distance < self.rel_l1_thresh)
470 if should_calc:
471 self.accumulated_rel_l1_distance = 0
472 self.previous_modulated_input = modulated_inp
473 self.step = (self.step + 1) % self.num_inference_steps
474 if should_calc:
475 self.previous_hidden_states = x.clone()
476 return not should_calc
477
478 def store(self, hidden_states):
479 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