Views
No views yet
z_image_turbo_scaled_fp8_e4m3fn.safetensors (6.17 GB) - FP8 E4M3FN quantized weightsz_image_turbo_int8.safetensors (6.17 GB) - INT8 quantized weights1git clone https://github.com/ModelTC/LightX2V.git
2cd LightX2V
3pip install .1from lightx2v import LightX2VPipeline
2
3# Initialize pipeline
4pipe = LightX2VPipeline(
5 model_path="Tongyi-MAI/Z-Image-Turbo",
6 model_cls="z_image",
7 task="t2i",
8)
9
10# Step 1: Enable quantization (FP8 transformer + INT4 text encoder)
11pipe.enable_quantize(
12 dit_quantized=True,
13 dit_quantized_ckpt="lightx2v/Z-Image-Turbo-Quantized/z_image_turbo_scaled_fp8_e4m3fn.safetensors",
14 quant_scheme="fp8-sgl",
15 # IMPORTANT: Use int4 Qwen3 for 8GB VRAM
16 text_encoder_quantized=True,
17 text_encoder_quantized_ckpt="JunHowie/Qwen3-4B-GPTQ-Int4",
18 text_encoder_quant_scheme="int4"
19)
20
21# Step 2: Enable CPU offloading
22pipe.enable_offload(
23 cpu_offload=True,
24 offload_granularity="model", # Use "model" for maximum memory savings
25)
26
27# Step 3: Create generator
28pipe.create_generator(
29 attn_mode="flash_attn3",
30 aspect_ratio="16:9",
31 infer_steps=9,
32 guidance_scale=1,
33)
34
35# Step 4: Generate image
36pipe.generate(
37 seed=42,
38 prompt="A beautiful landscape with mountains and lakes, ultra HD, 4K",
39 negative_prompt="",
40 save_result_path="output.png",
41)1dit_quantized_ckpt="lightx2v/Z-Image-Turbo-Quantized/z_image_turbo_scaled_fp8_e4m3fn.safetensors",
2quant_scheme="fp8-sgl",1dit_quantized_ckpt="lightx2v/Z-Image-Turbo-Quantized/z_image_turbo_int8.safetensors",
2quant_scheme="int8-sgl","model" (Recommended for 8GB): Offload entire model to CPU, load to GPU only during inference. Maximum memory savings."block": Offload individual transformer blocks. More fine-grained control.enable_quantize() and enable_offload() calls must be made before create_generator(), otherwise they will not take effect.