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

Method decode_small_video

diffsynth/models/cog_vae.py:254–269  ·  view source on GitHub ↗
(self, sample)

Source from the content-addressed store, hash-verified

252
253
254 def decode_small_video(self, sample):
255 B, C, T, H, W = sample.shape
256 computation_device = self.conv_in.weight.device
257 computation_dtype = self.conv_in.weight.dtype
258 value = []
259 for i in range(T//2):
260 tl = i*2 + T%2 - (T%2 and i==0)
261 tr = i*2 + 2 + T%2
262 model_input = sample[:, :, tl: tr, :, :].to(dtype=computation_dtype, device=computation_device)
263 model_output = self.forward(model_input).to(dtype=sample.dtype, device=sample.device)
264 value.append(model_output)
265 value = torch.concat(value, dim=2)
266 for name, module in self.named_modules():
267 if isinstance(module, CachedConv3d):
268 module.clear_cache()
269 return value
270
271
272 @staticmethod

Callers 1

decode_videoMethod · 0.95

Calls 3

forwardMethod · 0.95
toMethod · 0.45
clear_cacheMethod · 0.45

Tested by

no test coverage detected