Text-to-Video
Generate videos from text prompts with FastVideo, vLLM-Omni, SGLang, or TensorRT-LLM
Choose a backend for text-to-video generation. See the Diffusion Overview for installation and shared configuration.
FastVideo
vLLM-Omni
SGLang
TensorRT-LLM
This guide covers deploying FastVideo text-to-video generation on Dynamo using a custom worker (worker.py) exposed through the /v1/videos endpoint.
Dynamo also supports text-to-video through built-in backends: vLLM-Omni, SGLang, and TensorRT-LLM. See the Diffusion Overview for the full support matrix across all modalities.
Overview
- Default model:
FastVideo/FastWan2.1-T2V-1.3B-Diffusers. - Typed API: The worker builds
GeneratorConfigonce at startup and creates aGenerationRequestfor each/v1/videosrequest. - Optimized inference:
torch.compileand NVFP4 transformer quantization are available through--torch-compileand--fp4-quantization; the legacy--enable-optimizationsflag remains as a shortcut for both. - Response format: Returns one complete MP4 payload per request as
data[0].b64_json(non-streaming). - Concurrency: One request at a time per worker (VideoGenerator is not re-entrant). Scale throughput by running multiple workers.
worker.py defaults to --attention-backend VIDEO_SPARSE_ATTN and routes VSA_sparsity=0.8 through FastVideo’s typed PipelineSelection.experimental config. Keep this backend for FastWan 2.1 models; forcing TORCH_SDPA can instantiate a non-VSA Wan block and fail checkpoint loading. Use --attention-backend TORCH_SDPA for the LTX-2 compatibility path validated by the B300 smoke test.
Kubernetes Deployment
Kubernetes is the recommended path for running FastVideo on Dynamo. The steps below build and push the runtime image, deploy the aggregated worker, and send a first request. For a single-node development workflow, see Local Deployment at the bottom of this page.
Deployment Files
Prerequisites
- Dynamo Kubernetes Platform installed
- GPU-enabled Kubernetes cluster
- A container registry you can push the FastVideo runtime image to
- Optional HF token secret (for gated models)
Build and push the FastVideo runtime image
The runtime image is built from the Dockerfile:
- Base image:
nvidia/cuda:13.1.1-devel-ubuntu24.04 - Installs FastVideo
0.2.0from PyPI, which provides thefastvideo.apityped surface and NVFP4 transformer quantization support - Installs the
ai-dynamopackage with/v1/videossupport
Build and push the image:
A from-source flash-attention (FA4) build is deferred. The worker runs on FastVideo’s default attention backends without it.
Apply the cache PVC and deployment
Mounting a shared Hugging Face cache PVC means model weights are downloaded once and reused across pod restarts.
For clusters with tainted user-workload nodes and private registry pulls, set your pull secret name and image in agg_user_workload.yaml, then apply that variant instead:
To swap the image on an existing deployment quickly:
Send a test request
If this is the first request after startup, expect it to take longer while warmup completes. See Warmup Time for details.
FullHD Video with Audio (LTX-2)
LTX-2 models support native audio generation alongside video. LTX-2 requires width and height divisible by 32, so FullHD requests use 1920x1088 rather than 1920x1080.
Start the local example with an LTX-2 model:
Send the request from another terminal:
FastVideo exposes generated audio and audio_sample_rate on its Python result object. This Dynamo worker returns the saved MP4 in data[0].b64_json, with FastVideo muxing the generated 24 kHz audio into the MP4 output.
LTX-2 refine pipeline flags such as ltx2_refine_enabled, ltx2_refine_upsampler_path, and per-component compile settings are not yet exposed through FastVideo’s typed API config.
Warmup Time
On first start, workers download model weights. When --torch-compile is enabled, compile/warmup steps can push the first ready time to roughly 10–20 minutes (hardware-dependent). After the first successful compiled response, the second request can still take around 35 seconds while runtime caches finish warming up; steady-state performance is typically reached from the third request onward.
The shared Hugging Face cache PVC applied in the Kubernetes Deployment steps means weights are downloaded once and reused across pod restarts, so warmup is only paid in full on the very first start.
Worker Configuration Reference
CLI Flags
Request Parameters (nvext)
Environment Variables
Flags passed to worker.py:
HuggingFace model path.
Number of GPUs for distributed inference.
Dynamo discovery backend. Choices: etcd, file, mem, and kubernetes. Defaults to the environment, then Kubernetes or file discovery.
Sets FASTVIDEO_ATTENTION_BACKEND. Choices: FLASH_ATTN, TORCH_SDPA, SAGE_ATTN, SAGE_ATTN_THREE, VIDEO_SPARSE_ATTN, VMOBA_ATTN, SLA_ATTN, SAGE_SLA_ATTN.
Sets PipelineSelection.experimental["VSA_sparsity"]. The worker omits this value for other attention backends unless explicitly set.
Enables FastVideo CompileConfig.
Sets the torch.compile backend.
Sets the torch.compile mode. Choices: default, reduce-overhead, max-autotune, and max-autotune-no-cudagraphs.
Controls fullgraph mode.
Controls dynamic shapes.
Requests NVFP4 transformer quantization through QuantizationConfig(transformer_quant="NVFP4"). Confirm activation in worker logs before reporting FP4 results.
Backward-compatible shortcut for --torch-compile --fp4-quantization.
Controls FastVideo Fully Sharded Data Parallel (FSDP) inference.
Controls Diffusion Transformer (DiT) CPU offload.
Controls layerwise DiT CPU offload.
Controls variational autoencoder (VAE) CPU offload.
Controls image encoder CPU offload.
Controls text encoder CPU offload.
Controls pinned host memory for CPU offload transfers.
Controls autocast in FastVideo denoising and decoding paths.
Default request dimensions.
Default request duration in seconds.
Default request frame rate.
Default frame count.
Default diffusion inference steps.
Default classifier-free guidance scale.
Default random-number-generator seed. When unset, FastVideo uses its preset.
Rejects wider requests before calling FastVideo.
Rejects taller requests before calling FastVideo.
Rejects requests whose resolved frame count exceeds this cap.
Rejects requests whose inference-step count exceeds this cap.
Directory for generated MP4 staging files.
Troubleshooting
Hardware Support
The worker checks the GPU compute capability at startup and fails fast when the selected attention backend cannot run on the detected hardware:
Local Deployment
For single-node development you can run FastVideo directly with Docker Compose or a host-local script instead of Kubernetes.
Prerequisites
For Docker Compose:
- Docker Engine 26.0+
- Docker Compose v2
- NVIDIA Container Toolkit
For host-local script:
- Python environment with Dynamo + FastVideo dependencies installed
- CUDA-compatible GPU runtime available on host
Option 1: Docker Compose
The Compose file builds from the same Dockerfile used for the Kubernetes runtime image and exposes the API on http://localhost:8000.
Option 2: Host-Local Script
Environment variables:
Example:
FastVideo worker flags are not dynamo.frontend flags, so pass non-default worker configuration through WORKER_EXTRA_ARGS.
Validated B300 smoke-test worker configurations:
The FastWan FP4 configuration completed the smoke request, but the worker log did not show the NVFP4 weight-conversion marker. Treat --fp4-quantization as requested, not independently confirmed, for FastWan until the FastVideo logs expose that confirmation.
The script writes logs to:
.runtime/logs/worker.log.runtime/logs/frontend.log
Source Code
The example source lives at examples/diffusers/ in the Dynamo repository.
See Also
- Text-to-Video with vLLM-Omni — vLLM-Omni video generation via
/v1/videos - Text-to-Video with SGLang — SGLang video generation worker
- Text-to-Video with TensorRT-LLM — TensorRT-LLM diffusion quick start
- Diffusion Overview — Full backend support matrix