Skip to main content

1. Quick start

Follow the SGLang Diffusion installation guide for your GPU platform.

2. Model capabilities

Wan2.1 is a broad open video family covering text-to-video and image-to-video across 1.3B and 14B checkpoints. Its practical strengths are motion-rich generation, temporal consistency, and readable Chinese/English text, with 480p and 720p variants for different quality and memory targets. Choose the 1.3B T2V model for consumer-GPU experiments and the 14B models when quality matters more than footprint. Wan2.1 is a dense DiT family; for timestep-specialized MoE capacity or the unified 5B TI2V path, use Wan2.2 instead.

3. Model Deployment

This section provides deployment configurations optimized for different hardware platforms and use cases.

3.1 Basic Configuration

The Wan2.1 series offers models in multiple sizes and resolutions. SGLang supports Wan2.1 deployment on NVIDIA B200, B300, H200, H100, AMD MI300X, MI325X, MI355X GPUs, Intel Xeon CPUs, and Ascend A2/A3 Series NPUs. The recommended launch configurations vary by hardware, model size, and memory headroom. Use the command builder above.

3.2 Configuration Tips

Current supported optimization options are listed in the SGLang diffusion support matrix.
  • --vae-path: Path to a custom VAE model or HuggingFace model ID. If not specified, the VAE will be loaded from the main model path.
  • --num-gpus {NUM_GPUS}: Number of GPUs to use.
  • --tp-size {TP_SIZE}: Tensor parallelism size (for the encoder/DiT; keep (\leq 1) if relying heavily on CPU offload).
  • --sp-degree {SP_SIZE}: Sequence parallelism degree.
  • --ulysses-degree {ULYSSES_DEGREE}: Degree of DeepSpeed-Ulysses-style SP in USP.
  • --ring-degree {RING_DEGREE}: Degree of ring attention-style SP in USP.
  • --text-encoder-cpu-offload, --dit-cpu-offload, --vae-cpu-offload: Use CPU offload to reduce peak GPU memory when needed.

Optional UMT5 padding trim

Set SGLANG_DIFFUSION_WAN_TEXT_PADDING before starting sglang serve or sglang generate to change the UMT5 encoder’s padding:
  • max (default): pad to 512 tokens, preserving the existing inference path.
  • longest: pad to the longest prompt in the encoder batch.
  • bucket: use the longest prompt length rounded up to a multiple of 64.
The DiT still receives 512-token, zero-padded embeddings with a matching mask. Shorter encoder inputs can reduce text-encoding work, but change BF16 rounding and can produce a different video for the same seed. Keep max for output comparisons with the default path; trimming is not a bit-exact optimization. It does not reduce the DiT’s sequence length or denoising work.

3.3 24 GB NVIDIA GPUs

The 14B DiTs do not fit on a 24 GB card in BF16 (the I2V-14B one is 30.5 GiB), so their weights have to stream from host memory layer by layer. On CUDA, --performance-mode memory streams the DiT, text encoder, image encoder and VAE:
Each GPU’s worker keeps its own copy of the streamed weights in host memory, about 60 GiB, so 8 GPUs need close to 500 GiB of RAM. Measured with SGLang main c7be3e9 (2026-09-29) on RTX 4090 24 GB (PCIe, no P2P between GPUs), for Wan2.1-I2V-14B-480P image-to-video at 480x832, 81 frames, 40 steps, BF16: Component CPU offload (--dit-cpu-offload) does not help here: it moves the whole DiT onto the GPU around each use.

4. Model Invocation

4.1 Basic Usage

For more API usage and request examples, please refer to: SGLang Diffusion OpenAI API

4.1.1 Launch a server and then send requests

Use the Server and Request commands in the command builder for the selected checkpoint and T2V or I2V mode. The request submits an asynchronous job to POST /v1/videos; it does not return base64 image data. Poll GET /v1/videos/{video_id} until status is completed, then download GET /v1/videos/{video_id}/content to an MP4 file. If the job is failed, inspect its error instead. See Video generation for polling and download examples.

4.1.2 Generate a video without launching a server

Command

4.2 Advanced Usage

4.2.1 Cache-DiT Acceleration

SGLang integrates Cache-DiT, a caching acceleration engine for Diffusion Transformers (DiT), to achieve significant inference speedups with minimal quality loss. You can set SGLANG_CACHE_DIT_ENABLED=True to enable it. For more details, please refer to the SGLang Cache-DiT documentation. Basic Usage
Command
Advanced Usage Combined Configuration Example:
Command

4.2.2 GPU Optimization

  • --dit-cpu-offload: Keep DiT weights on the CPU and move them onto the GPU whole around each use. This takes the DiT out of FSDP, which shards only resident components.
  • --text-encoder-cpu-offload: Use CPU offload for text encoder inference.
  • --image-encoder-cpu-offload: Use CPU offload for image encoder inference.
  • --vae-cpu-offload: Use CPU offload for VAE.
  • --pin-cpu-memory: Pin memory for CPU offload. Use as a workaround if you see “CUDA error: invalid argument”.

4.2.3 Supported LoRA Registry

SGLang supports applying Wan2.1 LoRA adapters on top of base models:
origin modelsupported LoRA
Wan-AI/Wan2.1-T2V-14BNIVEDAN/wan2.1-lora
Wan-AI/Wan2.1-I2V-14B-720Pvaliantcat/Wan2.1-Fight-LoRA
Example:
Command

5. Reference Benchmark

The following benchmark is a point-in-time reference for one model, hardware platform, SGLang image, and parameter set. It is not a complete hardware support matrix. Test Environment:
  • Hardware: AMD MI300X GPU (1x)
  • Model: Wan-AI/Wan2.1-T2V-14B-Diffusers
  • SGLang Docker Image Version: 0.5.9

5.1 How to Run Benchmarks with SGLang

You can use the built-in SGLang diffusion benchmark script to evaluate Wan2.1 performance on your hardware.

5.1.1 Generate a single video

Server Command:
Command
Benchmark Command:
Command
Result:
Output

5.1.2 Generate videos with Cache-DiT acceleration

Server Command:
Command
Benchmark Command:
Command
Result:
Output

6. Run in ComfyUI