Signed-off-by: David Chen <530634352@qq.com> Signed-off-by: WeiQing Chen <40507679+david6666666@users.noreply.github.com>
2.6 KiB
2.6 KiB
Text-To-Video
The Wan-AI/Wan2.2-T2V-A14B-Diffusers pipeline generates short videos from text prompts. This script can also be used
for Lightricks/LTX-2 to generate video+audio.
Local CLI Usage
python text_to_video.py \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--negative-prompt "<optional quality filter>" \
--height 480 \
--width 832 \
--num-frames 33 \
--guidance-scale 4.0 \
--guidance-scale-high 3.0 \
--flow-shift 12.0 \
--num-inference-steps 40 \
--fps 16 \
--output t2v_out.mp4
LTX2 example:
python text_to_video.py \
--model "Lightricks/LTX-2" \
--prompt "A cinematic close-up of ocean waves at golden hour." \
--negative-prompt "worst quality, inconsistent motion, blurry, jittery, distorted" \
--height 512 \
--width 768 \
--num-frames 121 \
--num-inference-steps 40 \
--guidance-scale 4.0 \
--frame-rate 24 \
--output ltx2_out.mp4
Key arguments:
--prompt: text description (string).--height/--width: output resolution (defaults 480x832, i.e. 480P). Dimensions should align with Wan VAE downsampling (multiples of 8).--num-frames: Number of frames (Wan default is 81).--guidance-scaleand--guidance-scale-high: CFG scale (applied to low/high).--negative-prompt: optional list of artifacts to suppress (the PR demo used a long Chinese string).--boundary-ratio: Boundary split ratio for low/high DiT. Default0.875uses both transformers for best quality. Set to1.0to load only the low-noise transformer (saves noticeable memory with good quality, recommended if memory is limited). Set to0.0loads only the high-noise transformer (not recommended, lower quality).--fps: frames per second for the saved MP4 (requiresdiffusersexport_to_video).--output: path to save the generated video.--vae-use-slicing: enable VAE slicing for memory optimization.--vae-use-tiling: enable VAE tiling for memory optimization.--cfg-parallel-size: set it to 2 to enable CFG Parallel. See more examples inuser_guide.--tensor-parallel-size: tensor parallel size (effective for models that support TP, e.g. LTX2).--enable-cpu-offload: enable CPU offloading for diffusion models.--frame-rate: generation FPS for pipelines that require it (e.g., LTX2).--audio-sample-rate: audio sample rate for embedded audio (when the pipeline returns audio).
ℹ️ If you encounter OOM errors, try using
--vae-use-slicingand--vae-use-tilingto reduce memory usage.