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

Method check

diffsynth/pipelines/flashvsr_tiny.py:459–475  ·  view source on GitHub ↗
(self, dit: WanModel, x, t_mod)

Source from the content-addressed store, hash-verified

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