MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / __init__

Method __init__

lightx2v/utils/async_vae.py:24–42  ·  view source on GitHub ↗
(self, enabled: bool, device: torch.device | str | None = None)

Source from the content-addressed store, hash-verified

22 """
23
24 def __init__(self, enabled: bool, device: torch.device | str | None = None) -> None:
25 self.enabled = bool(enabled) and torch.cuda.is_available()
26 self._device = torch.device(device) if device is not None else None
27 if self._device is not None and self._device.type != "cuda":
28 self.enabled = False
29 self._stream: torch.cuda.Stream | None = None
30 self._prev_vae_done: torch.cuda.Event | None = None
31 self._chunks: list[torch.Tensor] = []
32 self._decode_events: list[tuple[torch.cuda.Event, torch.cuda.Event]] = []
33 self._num_submitted = 0
34 self._sync_decode_ms = 0.0
35 self._submit_wait_ms = 0.0
36 self._finish_wait_ms = 0.0
37 self._logged_decode_events = 0
38 self._vae_decoder: Any | None = None
39 self._saved_vae_cpu_offload = False
40
41 if bool(enabled) and not self.enabled:
42 logger.warning("[AsyncVAEChunkDecoder] async VAE requested but CUDA is unavailable; falling back to sync decode.")
43
44 @classmethod
45 def from_config(

Callers

nothing calls this directly

Calls 3

warningMethod · 0.80
is_availableMethod · 0.45
deviceMethod · 0.45

Tested by

no test coverage detected