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

Method encode_video

diffsynth/models/sd3_vae_encoder.py:76–91  ·  view source on GitHub ↗
(self, sample, batch_size=8)

Source from the content-addressed store, hash-verified

74 return hidden_states
75
76 def encode_video(self, sample, batch_size=8):
77 B = sample.shape[0]
78 hidden_states = []
79
80 for i in range(0, sample.shape[2], batch_size):
81
82 j = min(i + batch_size, sample.shape[2])
83 sample_batch = rearrange(sample[:,:,i:j], "B C T H W -> (B T) C H W")
84
85 hidden_states_batch = self(sample_batch)
86 hidden_states_batch = rearrange(hidden_states_batch, "(B T) C H W -> B C T H W", B=B)
87
88 hidden_states.append(hidden_states_batch)
89
90 hidden_states = torch.concat(hidden_states, dim=2)
91 return hidden_states
92
93 @staticmethod
94 def state_dict_converter():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected