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

Method encode_video

diffsynth/models/cog_vae.py:323–336  ·  view source on GitHub ↗
(self, sample, tiled=True, tile_size=(60, 90), tile_stride=(30, 45), progress_bar=lambda x:x)

Source from the content-addressed store, hash-verified

321
322
323 def encode_video(self, sample, tiled=True, tile_size=(60, 90), tile_stride=(30, 45), progress_bar=lambda x:x):
324 if tiled:
325 B, C, T, H, W = sample.shape
326 return TileWorker2Dto3D().tiled_forward(
327 forward_fn=lambda x: self.encode_small_video(x),
328 model_input=sample,
329 tile_size=(i * 8 for i in tile_size), tile_stride=(i * 8 for i in tile_stride),
330 tile_device=sample.device, tile_dtype=sample.dtype,
331 computation_device=sample.device, computation_dtype=sample.dtype,
332 scales=(16/3, (T//4+T%2)/T, 1/8, 1/8),
333 progress_bar=progress_bar
334 )
335 else:
336 return self.encode_small_video(sample)
337
338
339 def encode_small_video(self, sample):

Callers

nothing calls this directly

Calls 3

encode_small_videoMethod · 0.95
TileWorker2Dto3DClass · 0.85
tiled_forwardMethod · 0.45

Tested by

no test coverage detected