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

Method encode_small_video

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

Source from the content-addressed store, hash-verified

337
338
339 def encode_small_video(self, sample):
340 B, C, T, H, W = sample.shape
341 computation_device = self.conv_in.weight.device
342 computation_dtype = self.conv_in.weight.dtype
343 value = []
344 for i in range(T//8):
345 t = i*8 + T%2 - (T%2 and i==0)
346 t_ = i*8 + 8 + T%2
347 model_input = sample[:, :, t: t_, :, :].to(dtype=computation_dtype, device=computation_device)
348 model_output = self.forward(model_input).to(dtype=sample.dtype, device=sample.device)
349 value.append(model_output)
350 value = torch.concat(value, dim=2)
351 for name, module in self.named_modules():
352 if isinstance(module, CachedConv3d):
353 module.clear_cache()
354 return value
355
356
357 @staticmethod

Callers 1

encode_videoMethod · 0.95

Calls 3

forwardMethod · 0.95
toMethod · 0.45
clear_cacheMethod · 0.45

Tested by

no test coverage detected