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

Function _load_float_quantize

lightx2v/utils/quant_utils.py:5–21  ·  view source on GitHub ↗

Lazy import of qtorch.float_quantize. qtorch triggers a JIT C++ extension build on import, which blocks ComfyUI startup. Defer it until the first call site that needs it (only the online fp8 weight-quant path uses float_quantize).

()

Source from the content-addressed store, hash-verified

3
4
5def _load_float_quantize():
6 """Lazy import of qtorch.float_quantize.
7
8 qtorch triggers a JIT C++ extension build on import, which blocks
9 ComfyUI startup. Defer it until the first call site that needs it
10 (only the online fp8 weight-quant path uses float_quantize).
11 """
12 global float_quantize
13 if float_quantize is _UNLOADED:
14 try:
15 from qtorch.quant import float_quantize as _fq
16
17 float_quantize = _fq
18 except Exception:
19 logger.warning("qtorch not found, please install qtorch (pip install qtorch).")
20 float_quantize = None
21 return float_quantize
22
23
24_UNLOADED = object()

Callers 1

quantMethod · 0.85

Calls 1

warningMethod · 0.80

Tested by

no test coverage detected