To reduce GPU memory usage, use FP8 quantization. You must set the environment variable PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True when launching your process.
Available Quantization Policies
| Policy | CLI Flag | Description |
|---|
| FP8 Cast | --quantization fp8-cast | Downcasts transformer linear weights to FP8 during loading; upcasts on the fly during inference. No extra dependencies. |
| FP8 Scaled MM | --quantization fp8-scaled-mm | Uses FP8 scaled matrix multiplication via PyTorch's torch._scaled_mm. Best performance on Hopper+ GPUs with native FP8 support. |
Usage via CLI
# FP8 Cast
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True python -m ltx_pipelines.ti2vid_two_stages \
--quantization fp8-cast --checkpoint-path=...
# FP8 Scaled MM
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True python -m ltx_pipelines.ti2vid_two_stages \
--quantization fp8-scaled-mm --checkpoint-path=...
Usage Programmatically
Pass a QuantizationPolicy to your pipeline class using the appropriate build function from ltx_core.
from ltx_core.quantization.fp8_cast import build_policy as build_fp8_cast_policy
# Alternative:
# from ltx_core.quantization.fp8_scaled_mm import build_policy as build_fp8_scaled_mm_policy
pipeline = TI2VidTwoStagesPipeline(
checkpoint_path=ltx_model_path,
distilled_lora=distilled_lora,
spatial_upsampler_path=upsampler_path,
gemma_root=gemma_root_path,
loras=[],
quantization=build_fp8_cast_policy(ltx_model_path),
)
pipeline(...)