MCPcopy Create free account
hub / github.com/KlingAIResearch/ReCamMaster / encode_video

Method encode_video

diffsynth/models/sd_vae_encoder.py:80–95  ·  view source on GitHub ↗
(self, sample, batch_size=8)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected