from lightx2v import LightX2VPipeline
# Initialize pipelinepipe = LightX2VPipeline( model_path="/path/to/hunyuanvideo-1.5/", # Original model path model_cls="hunyuan_video_1.5", transformer_model_name="720p_t2v", task="t2v",)
# Enable quantizationpipe.enable_quantize( quant_scheme='fp8-sgl', dit_quantized=True, dit_quantized_ckpt="/path/to/hy15_720p_t2v_fp8_e4m3_lightx2v.safetensors", text_encoder_quantized=True, text_encoder_quantized_ckpt="/path/to/hy15_qwen25vl_llm_encoder_fp8_e4m3_lightx2v.safetensors", image_encoder_quantized=False,)
# Optional: Enable offloading for lower VRAM usagepipe.enable_offload( cpu_offload=True, offload_granularity="block", # For HunyuanVideo-1.5, only "block" is supported text_encoder_offload=True, image_encoder_offload=False, vae_offload=False,)
# Optional: Use lighttaepipe.enable_lightvae( use_tae=True, tae_path="/path/to/lighttaehy1_5.safetensors", use_lightvae=False, vae_path=None,)
# Create generatorpipe.create_generator( attn_mode="sage_attn2", infer_steps=50, num_frames=121, guidance_scale=6.0, sample_shift=9.0, aspect_ratio="16:9", fps=24,)
# Generate videoseed = 123prompt = "A beautiful sunset over the ocean with waves gently crashing on the shore."negative_prompt = ""save_result_path="/path/to/output.mp4"
pipe.generate( seed=seed, prompt=prompt, negative_prompt=negative_prompt, save_result_path=save_result_path,)