Run Multi-GPU Parallel Inference
mainStep-Video-T2V uses a decoupling strategy for the text encoder, VAE decoding, and DiT to optimize GPU resource utilization. This requires a dedicated GPU to handle API services for text encoder embeddings and VAE decoding.
- Start the remote server to get the caption and VAE API URLs:
python api/call_remote_server.py --model_dir <your_model_dir> & - Run the parallel inference script using
torchrun. Ensure thattp_degree(tensor parallel) multiplied byulysses_degreeequals the totalparallelcount.
python api/call_remote_server.py --model_dir where_you_download_dir & ## This returns the URL for caption and VAE APIs
parallel=4
url='127.0.0.1'
model_dir=where_you_download_dir
tp_degree=2
ulysses_degree=2
# make sure tp_degree x ulysses_degree = parallel
torchrun --nproc_per_node $parallel run_parallel.py --model_dir $model_dir --vae_url $url --caption_url $url --ulysses_degree $ulysses_degree --tensor_parallel_degree $tp_degree --prompt "一名宇航员在月球上发现一块石碑,上面印有“stepfun”字样,闪闪发光" --infer_steps 50 --cfg_scale 9.0 --time_shift 13.0