Video Generation
Three video families: LTX 2.5 Distilled generates video with 48 kHz stereo, MiniMax-H3 generates video with 32 kHz stereo, and Wan 2.1 / 2.2 generates video. This page covers the current implementation, files, recipes, and measured scope.
These commands follow the same conventions as the text-model recipes β the Hugging Face CLI, a source build from the repository root, and --backend swapped to match your hardware. See Download & run, per family.
LTX 2.5 Distilled (video and 48 kHz stereo)
Current source implements the complete two-stage distilled pipeline: the dedicated 48-layer Gemma 4 Unified encoder, audio/video connectors, joint denoiser, video VAE, and audio VAE/vocoder. Eight published ancestral Euler steps run at half the output size, the required x2 spatial latent upscaler doubles the latent, and three refinement steps run at full size. CFG is fixed at 1. A request's steps: 8 names the first-pass schedule. Explicit --sampler euler selects a deterministic diagnostic.
config/ltx-2.5-distilled.json pins five files by commit and SHA-256, totaling 44,764,412,884 bytes. The official companions require approved Hugging Face access: configure HF_TOKEN, HUGGING_FACE_HUB_TOKEN, or the HF CLI token cache. The dedicated encoder embeds its tokenizer; a stock Gemma 4 checkpoint is not a substitute. The convolutional video VAE is the default.
TENSORSHARP_MODELS=/path/to/models MLX_ENABLE_TF32=0 \
dotnet run --project TensorSharp.Cli -- \
--config config/ltx-2.5-distilled.json --backend mlx \
--prompt "A red toy car drives along a quiet road in warm afternoon light." \
--diffusion-seed 42 --output ltx25.mp4
Defaults are 1024Γ1024, 17 frames, 24 fps; width and height must be multiples of 64 and frames follow 8k+1. TensorAgent's experimental LTX 2.5 Distilled β Q4_K_M + BF16 entry uses a conservative 48 GB tier: Download fetches all five files and Use activates the model. This is not a measured memory minimum or a promise for arbitrary sizes and durations.
cuda / ggml_cuda use TensorSharp's direct CUDA executor; mlx / ggml_metal use MLX; cpu / ggml_cpu use the direct CPU implementation. Vulkan and multi-GPU are unsupported. Launch Apple processes with MLX_ENABLE_TF32=0 for the Float32 quality path; the Mac app sets this default at startup. Desktop MP4 audio needs FFmpeg or TS_FFMPEG, and the original 48 kHz stereo WAV is also saved; the Mac app uses AVFoundation.
Timeline guides and identity references
First, last, both endpoint, and multiple explicitly timed image guides are supported. An ordinary referenceImages list becomes evenly spaced timeline keyframes; one image anchors frame zero. videoMode: "ref" instead needs the optional Ingredients IC-LoRA for character, prop or location identity sheets and keeps one full-size pass; its trained preview is 768Γ448Γ121. Reference video/audio, retake, specialized control pipelines, HDR/EXR and multi-GPU remain unavailable.
--video-upscaler / TS_VIDEO_UPSCALER selects the upscaler. Optional --video-diffusion-vae selects a less grainy/flickery but softer diffusion decoder on MLX/CPU only; CUDA refuses it. The model card and reproduction guide distinguish actual CUDA, MLX and Mac Catalyst short-clip runs from component gates. Component checks, earlier single-pass timings and successful exports do not establish broad quality or performance parity for today's two-stage recipe.
MiniMax-H3 (prompt β video with audio)
H3 denoises video and 32 kHz stereo audio together in one packed latent. FL2VA supports text, image-to-video and endpoint keyframes; Ref2VA supports identity references. The checkpoint is CFG-distilled and requires --cfg 1.0; the default is 20 steps. Fewer base steps give a quicker, rougher preview, and the Turbo plug-ins sample FL2VA in the 8 or 4 steps they were distilled for. Use the 2026-10-15 validation for current performance and precision; older Metal and 16 GB laptop speed ratios are superseded. Four networks and tokenizer files are needed:
# denoiser + text encoder
hf download unsloth/MiniMax-H3-GGUF minimax_h3_fl2va_pruned-Q4_K.gguf --local-dir models
hf download unsloth/MiniMax-H3-GGUF qwen3vl_32b_minimax_h3-Q4_K_M.gguf --local-dir models
# the two VAEs
hf download Comfy-Org/MiniMax-H3 vae/minimax_h3_video_vae_fp16.safetensors --local-dir models
hf download Comfy-Org/MiniMax-H3 vae/minimax_h3_audio_vae_fp32.safetensors --local-dir models
# the text encoder ships NO tokenizer: three files from the upstream repo, beside the encoder
curl -L -o models/vocab.json https://huggingface.co/MiniMaxAI/MiniMax-H3/resolve/42ed227ee7df40d41602854ae760620d6eb651fe/processor/vocab.json
curl -L -o models/merges.txt https://huggingface.co/MiniMaxAI/MiniMax-H3/resolve/42ed227ee7df40d41602854ae760620d6eb651fe/processor/merges.txt
curl -L -o models/tokenizer_config.json https://huggingface.co/MiniMaxAI/MiniMax-H3/resolve/42ed227ee7df40d41602854ae760620d6eb651fe/processor/tokenizer_config.json
# text β video (+ audio). Writes fox.mp4 and fox.wav
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/minimax_h3_fl2va_pruned-Q4_K.gguf \
--backend ggml_metal --prompt "a red fox trotting through falling snow, cinematic" \
--width 640 --height 384 --video-frames 22 --diffusion-steps 8 --cfg 1.0 --output fox.mp4
The text-encoder GGUF carries no tokenizer. The shipped config fetches pinned vocab.json, merges.txt and tokenizer_config.json beside the encoder. tokenizer_config.json defines <|vision_start|>, <|image_pad|> and <|vision_end|>; manual installs can set TS_VIDEO_TOKENIZER.
The single config, config/minimax-h3-fl2va.json, fetches both mode-specific denoisers, the shared text encoder and VAEs, and the tokenizer files (~46 GB total). The loaded host can switch between first/last-frame and reference modes without restarting:
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --config config/minimax-h3-fl2va.json \
--prompt "a red fox trotting through falling snow, cinematic" --output fox.mp4
dotnet TensorSharp.Server.Host/bin/TensorSharp.Server.Host.dll --config config/minimax-h3-fl2va.json
What an image means
An image can mean two completely different things to H3, and they use different checkpoints. The mode is inferred from what you pass; --video-mode states it explicitly.
| What you want | --video-mode | Checkpoint |
|---|---|---|
| βanimate this photoβ β it becomes the first frame | i2v | minimax_h3_fl2va_pruned-* |
| βgo from photo A to photo Bβ | fl2v | minimax_h3_fl2va_pruned-* |
| βuse this person, brand-new sceneβ | ref | minimax_h3_ref2va_pruned-* |
| βreference this product, new angle and backgroundβ | ref | minimax_h3_ref2va_pruned-* |
| text only | t2v | either |
The two denoisers are separate files rather than settings, and each refuses the other's inputs by name: ask for ref on FL2VA and the error tells you to load minimax_h3_ref2va_pruned-*.gguf; pass --image/--end-image as keyframes on Ref2VA and it tells you to load the FL2VA file, or to re-pass the picture as --ref-image. Keyframes and named references in one request are refused outright rather than one being quietly dropped β a clip that came back looking like the request was honoured is the worse failure. Which partition is active is read off the file name: ref2va anywhere in it, case-insensitive, selects reference conditioning, so keep it there if you rename or requantize.
# animate a photo: it becomes the first frame
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/minimax_h3_fl2va_pruned-Q4_K.gguf \
--backend ggml_metal --image portrait.jpg \
--prompt "the person turns toward the camera and smiles, subtle handheld motion" \
--video-frames 22 --diffusion-steps 8 --cfg 1.0 --output animated.mp4
# first and last frame: both ends pinned, the model fills in the motion
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/minimax_h3_fl2va_pruned-Q4_K.gguf \
--backend ggml_metal --image start.png --end-image end.png \
--prompt "a slow cinematic push-in" \
--video-frames 22 --diffusion-steps 8 --cfg 1.0 --output morph.mp4
# reference: keep the subject, change camera, background and composition
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/minimax_h3_ref2va_pruned-Q4_K.gguf \
--backend ggml_metal --ref-image person.jpg --ref-image bottle.png \
--prompt "she holds the bottle up to the light on a rooftop at golden hour, slow orbit" \
--width 640 --height 384 --video-frames 22 --diffusion-steps 20 --cfg 1.0 --output rooftop.mp4
The two keyframe examples give no size on purpose: i2v and fl2v keep the keyframe's framing, so the canvas comes from the first keyframe by MiniMax's released 768p recipe β 1152Γ768 for a 3:2 photo, 768Γ1152 for a 2:3 portrait (sizes). References are only ever scaled down and keep their own aspect ratio, so the output canvas still comes from --width/--height, or 640Γ384 when neither is given. A plain --image on the Ref2VA checkpoint is treated as a single reference and keeps 640Γ384's area at that image's aspect, so clients that only attach βan imageβ β the Web UI among them β work against it unchanged.
References: stills, clips and soundtracks
Up to nine references, in any mix. --ref-image is a still, referred to in the prompt as <Picture 1>, <Picture 2>, β¦; --ref-video is a clip β a video file or a directory of frames β resampled onto H3's own 24 fps and its own canvas, and referred to as <Video 1>, <Video 2>, β¦; --ref-audio is a soundtrack, resampled to the audio VAE's 32 kHz stereo and truncated to the generated clip's duration. A clip's own sound goes in separately with --ref-video-audio, paired by position with --ref-video, because a container's audio track is not readable through the frame decoder.
# a clip, with its own soundtrack alongside it
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/minimax_h3_ref2va_pruned-Q4_K.gguf \
--backend ggml_metal --ref-video walk.mp4 --ref-video-audio walk.wav \
--prompt "the same woman walks along a beach at sunset, wide shot, waves behind her" \
--width 640 --height 384 --video-frames 22 --diffusion-steps 20 --cfg 1.0 --output beach.mp4
# a still plus a standalone soundtrack
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/minimax_h3_ref2va_pruned-Q4_K.gguf \
--backend ggml_metal --ref-image singer.jpg --ref-audio song.wav \
--prompt "she performs on a small club stage under a single spotlight" \
--width 640 --height 384 --video-frames 22 --diffusion-steps 20 --cfg 1.0 --output stage.mp4
References add vision/text conditioning, VAE encoding and packed denoiser tokens. Their cost depends on geometry, duration, checkpoint and backend; use fewer focused references and measure the complete request on your hardware.
Length, size, and the long-clip ceiling
With no size given, text-to-video and references run at 640Γ384. Image-to-video and first/last-frame take the canvas from the first keyframe (the last one when it is the only one) by MiniMax's released 768p recipe: the keyframe's aspect at a 768-pixel short edge, capped at 768Γ1344 pixels, each side on the nearest multiple of 32 β 1152Γ768 for a 3:2 photo, 768Γ1152 for a 2:3 portrait, 1024Γ768 for 4:3, 1344Γ768 for 16:9 and 768Γ768 for a square, matching vllm-omni and sglang. The aspect is clamped to 1:4β4:1 and the excess is centre-cropped. Those modes keep the keyframe's framing, and the video VAE downsamples 16Γ in each direction: fitted to 640Γ384, a full-body photo leaves a face about 60 px tall, and a plain VAE encode and decode already smears it, with no denoiser involved. On its recipe canvas the face survives. That costs about 2.4Γ (square) to 4.2Γ (16:9 and wider) the video tokens per frame of 640Γ384 β 3.2Γ for 4:3, 3.6Γ for 3:2 β and attention cost grows faster than that, so a run takes several times longer. --width and --height together pin one size for every mode, keyframes included; with only one of them, the other side follows the image's aspect. The TensorAgent app keeps the compact 640Γ384-area canvas at the photo's aspect (608Γ416 for 3:2) until the recipe size's peak memory is measured on its 32 GB tier.
An explicit width and height round up to a multiple of 32. The frame count rounds up onto the 17k+5 grid β 5, 22, 39, 56, 73, 90 β¦ β which comes from the video VAE's temporal chunking rather than an arbitrary choice, and fps is pinned to 24 whatever you ask for. The VAE implements chunked decoding across this grid: the VAE runs 5 latent frames at a time with a 2-frame look-ahead and cross-fades the seams. Decoding a long clip in one call instead washes detail out progressively β measured against the conditioning photo, frame 0 fell from 0.97 correlation at 22 frames to 0.86 at 90 β so the chunking is a correctness requirement, not an optimization. --no-audio skips the audio decode when only the picture is wanted, saving the audio VAE's time and memory.
Long clips used to come back black. H3 attends bidirectionally over one unmasked packed sequence, so its key count is the whole clip β 2364 tokens at 22 frames, 8646 at 107 β and every upstream ggml flash-attention kernel keeps the softmax numerator in FP16 with three bits of headroom. A 107-frame clip overflowed to NaN on the first denoise step and came back with every pixel black and every audio sample clamped, while 73 frames of the same request rendered correctly. h3_attend now pre-scales V by a power of two derived from the key count and undoes it on the output β exact, because attention is linear in V β and the sampler refuses to save a diverged clip, failing the request and naming the step instead of writing a black file.
Audio export preserves a sidecar .wav. MP4 audio depends on the export provider: FFmpeg or the Apple AVFoundation path can mux it; other paths can return video with a separate WAV. Inspect audioMuxed where the route exposes it, or join the files with ffmpeg -i fox.mp4 -i fox.wav -c:v copy -c:a aac fox_with_audio.mp4. Long-clip perceptual quality is not established by chunked decoding or a finite output. See the MiniMax-H3 card.
Turbo plug-ins: 8 or 4 steps
LightX2V's Turbo LoRAs distill the FL2VA checkpoint to 8 or 4 transformer passes instead of the base 20. Two plug-in configs, config/lora/minimax-h3-fl2v-turbo-8step.json and -4step.json, apply them on the CLI and the server. Each downloads its weights on first use from lightx2v/Minimax-h3-Turbo, pinned to revision a29e57d and SHA-256-checked (1,383,677,808 bytes each, Apache-2.0), into minimax-h3/loras/ under the models root.
# CLI: the plug-in's recipe takes the place of --diffusion-steps / --flow-shift / --sampler
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --config config/minimax-h3-fl2va.json \
--lora config/lora/minimax-h3-fl2v-turbo-8step.json \
--prompt "a red fox trotting through falling snow, cinematic" --output fox-turbo.mp4
# Server: every clip samples the plug-in's recipe; requests leave "steps" out
dotnet TensorSharp.Server.Host/bin/TensorSharp.Server.Host.dll --config config/minimax-h3-fl2va.json \
--lora config/lora/minimax-h3-fl2v-turbo-4step.json
| Plug-in | Steps | Recipe |
|---|---|---|
LightX2V Turbo 8-step (FL2V v1.0, 768p), -8step.json | 8 | Euler on the endpoint-inclusive linspace grid, video shift 6, audio shift 3, CFG 1, as the publisher states it |
LightX2V Turbo 4-step (FL2V v1.2, 768p), -4step.json | 4 | The same grid and shifts. Inferred: the publisher states no recipe for v1.2 and the file records no shift, so this is carried over from its 4-step v1.0 row until it is validated |
- The recipe is locked, not a default. Steps, video flow shift, sampler and CFG may be left unset or repeat the plug-in's values; anything else is refused with a message naming the plug-in, never overridden.
--diffusion-steps,--flow-shift,--samplerand--cfgon the CLI, and--video-stepson the server, stop at startup with oneConfiguration error:line before anything downloads, the files of a--configincluded. A request'ssteps,flowShiftorsamplergets a400on/api/video-generateand/v1/videos/generations, and a{done, error}event on the stream route. Video Studio fixes the step count and answers409 sampling_recipe_conflictfor a shot planned under another recipe. A plug-in inherited throughTS_LORASgets the same checks. - FL2VA only, and only as the plug-in config. The Ref2VA checkpoint refuses it (Ref2VA Turbo is not supported), and so is a bare
.safetensors, because the config declares the partition and the recipe. Two H3 plug-ins at once, a Qwen-Image-2.1 plug-in on H3 and a negative--lora-scaleare refused too. Strength 0 keeps the adapter's terms with zero up factors, so each forward equals the base checkpoint's: an identity probe. - Applied unmerged on the quantized weights, as the publisher's inference script does through PEFT: 312 terms on q, k, v, out, fc1 and fc2 of the 50 DiT blocks and the 2 token-refiner blocks, held as 1.38 GB of F16 factors on
ggml_metalandggml_cudaand 2.77 GB of F32 onggml_cpu. The canvas defaults do not change; the adapters were trained at 768p, and a clip whose short edge is not 768 logs one line saying so. - Where it applies. The CLI and the server take it with
--lora; Video Studio shows the recipe and binds each job to it; the TensorAgent app offers both plug-ins on its keyframes entry as speed plug-ins, applied per clip in chat and in Studio. - Validated so far: the refusals on every host, the native LoRA helpers on
cpuandmetal, two-block synthetic parity (direct CPU against a checkpoint with the update merged in, andggml_cpuandggml_metalagainst direct CPU), and the real adapter files on CPU, whose sampled rows match the publisher's ComfyUI-format twins bit for bit. Measured on the M5 Pro (ggml_metal, FL2VA keyframes, 1280Γ768Γ107, seed 42, one run each): base 20 steps 5,438.5 s, Turbo-8 2,298.7 s, Turbo-4 1,238.6 s, with the adapter costing under 1% per step. Strength 0 gives a first-step video velocity bit-identical to base. Faces stay sharp in both Turbo clips. Against base, the Turbo clips cut between dissimilar keyframes instead of dissolving, are slightly more saturated and have a louder soundtrack. A 4-step run at video shift 12 looked as clean as shift 6, so the 4-step recipe stays inferred. Not yet measured: peak memory with an adapter, text-to-video at 640Γ384, more seeds, and any adapter run onggml_cuda, directcudaormlx. Contract, sigma tables and status β
2026-10-15: current performance and precision
These are equal-precision before/after comparisons, not speed ratios against stable-diffusion.cpp. FL2VA Q4_K, 640Γ384Γ22 at 24 fps, 20 Euler steps, seed 42, CFG 1 and flow shift 12; two alternating rounds include loading, generation and codecs. The M5 Pro has 48 GiB unified memory; the A40 reports 46,068 MiB VRAM/CUDA 12.8. OS caches are uncontrolled, so these are not warm-model service benchmarks. Both binaries use unchanged upstream ggml 3612c0af93f2cfc8f048295300a61187723b12ae.
| Backend / host | Baseline median | Candidate median | Result |
|---|---|---|---|
| M5 Pro native Metal | 151.246 s | 143.622 s | 5.0% lower latency |
| M5 Pro direct MLX | 143.264 s | 125.426 s | 12.5% lower latency |
| A40 native CUDA | 68.029 s | 67.174 s | 1.3% does not establish a meaningful gain |
| A40 direct CUDA, equal precision | 220.456 s | 178.667 s | 19.0% lower latency |
Decoded RGB and audio are exact in every complete comparison. Optimizations reduce repeated RoPE/slice/modulation work, cache native CUDA graph bindings, and let the MLX VAE own F32 weights directly. A fixed-latent check reduced median sampled warm process RSS from 23.048 to 14.024 GiB; that is not a measured reduction in peak unified/GPU memory.
Direct CUDA BF16-weight projections now default to pedantic F32; TS_H3_CUDA_BF16_PEDANTIC=0 restores the historical approximation. Against an independent PyTorch F32 synthetic all-50-block reference, audio/video relative L2 errors are 0.000125891 / 0.000084754, both below the 0.001 gate. This does not establish multi-step natural-media perceptual quality. Experimental batched attention failed the full-generation quality gate and its model opt-in was removed.
The final build additionally passed focused CPU/MLX and remote CUDA tests, nine component oracles on each of four GPU lanes, and complete-generation preservation pairs; those preservation pairs are not new timing samples. Every clip prints its per-phase and per-step timings ([diffusion] lines). See the reproduction guide for exact conditions, coverage and rejected experiments.
Long-sequence attention on Metal. A 1280Γ768Γ107 first/last-frame clip on FL2VA is 34,991 packed tokens, and at that length attention dominates each step. ggml-metal runs a long flash attention on its Metal 4 tensor-API kernel only when the key count is a multiple of 64, so TensorSharp pads the keys with masked zero rows (which leaves the result unchanged) and runs the queries in chunks that share one small mask. On an M5 Pro with ggml_metal, unchanged ggml a05c9922613c6a2230dbb1d0de679519ecafb4f0, 20 steps and seed 42, the whole run went from 11,553.8 s to 5,438.5 s (2.12Γ), about 570 s to 263 s per step. These are single runs on one machine, timed as the CLI reports a whole clip; TS_METAL_FLASH_KV_PAD=0 turns the padding off for A/B runs.
Backends and validation scope
Six backends have separate execution paths: ggml_metal, ggml_cuda and ggml_cpu use TensorSharp's native ggml integration; mlx, cuda and cpu use direct implementations. Pure C# CPU supports text, endpoint keyframes and reference images/video/audio without ggml; full-checkpoint throughput remains constrained by host resources. Synthetic components, technical smokes and successful exports do not establish perceptual quality for every mode; see the model card for exact image/audio reference gates. Video noise uses --diffusion-seed.
Serving it
On the server, size is a startup flag, because the browser sends none of its own, and for H3 the recommended setup leaves --video-width / --video-height unset: text-to-video and references then run at 640Γ384, and i2v/fl2v take the first keyframe's recipe size. Setting both pins one size for every mode, keyframes included, and turns off Studio's βFrom the first frameβ size (--width / --height are accepted aliases, and if only one is given H3 takes the other from the conditioning image's aspect ratio). --video-steps 20 matches the default step count. --video-mode pins the conditioning mode for a deployment that offers only one; omit it and every request infers its own. --video-frames, --fps, --video-vae, --video-text-encoder and --audio-vae complete the set. The server has no --cfg at all, which is why the shipped configs set neither steps nor guidance.
dotnet TensorSharp.Server.Host/bin/TensorSharp.Server.Host.dll --model models/minimax_h3_fl2va_pruned-Q4_K.gguf \
--backend ggml_metal --video-steps 20 --video-frames 22
curl -s http://localhost:5000/api/video-generate -H 'content-type: application/json' -d '{
"prompt": "a red fox trotting through falling snow, cinematic",
"frames": 22, "steps": 8, "cfg": 1.0,
"imagePath": "card.jpeg", "videoMode": "i2v"
}'
To serve the Turbo recipe, add --lora config/lora/minimax-h3-fl2v-turbo-8step.json (or the 4-step one) and leave --video-steps unset or at the plug-in's count; requests should then leave steps out, as the Web UI does. The example's "steps": 8 is accepted only by the 8-step plug-in, and a contradicting value is refused rather than overridden.
Three routes accept that body: POST /api/video-generate, POST /api/video-generate/stream (the same thing with SSE progress ticks) and the OpenAI-shaped POST /v1/videos/generations. They share one parser, so videoMode, generateAudio, endImage, referenceImages, referenceVideos, referenceAudios and referenceVideoAudios work on all three, each also accepting a snake_case spelling; referenceVideoAudios pairs by index with referenceVideos. The response carries audioUrl β audio_url on the OpenAI route β which is null when the model produced no track, and, except on the OpenAI route, audioMuxed, which says whether the MP4 carries the track as well. Every file field names something previously uploaded through /api/upload and is confined to the upload directory. A model rejection (the wrong checkpoint, keyframes together with references) comes back as a 400 carrying the model's own message rather than a generic 500.
GET /api/models answers with a video object β null for every non-video model β carrying family (minimax-h3), supportsAudio, supportsImageConditioning, supportsEndImageConditioning, supportsReferenceConditioning and maxReferenceImages. That is how the Web UI learns whether to offer a first frame, a last frame, or up to nine references: it enables the reference-attachment control on supportsReferenceConditioning and caps the stills at maxReferenceImages, instead of pattern-matching an architecture string.
Wan 2.1 / 2.2 (prompt β video, image β video)
Download the Turbo DiT, not the base one. The base Wan2.2-TI2V-5B follows the official 50-step Γ CFG recipe β 100 DiT passes per video. The step-distilled Turbo build of the same model is trained to run guidance-free in 4 steps, TensorSharp recognizes it from the file name, and the identical request comes back in minutes instead of hours. The Turbo repository ships only the DiT, so the VAE and the text encoder still come from the base repositories:
# The fast lane: 4 DiT passes instead of 100. Note the underscore in "Wan2_2".
hf download hum-ma/Wan2.2-TI2V-5B-Turbo-GGUF Wan2_2-TI2V-5B-Turbo-Q8_0.gguf --local-dir models
hf download QuantStack/Wan2.2-TI2V-5B-GGUF VAE/Wan2.2_VAE.safetensors --local-dir models
hf download city96/umt5-xxl-encoder-gguf umt5-xxl-encoder-Q8_0.gguf --local-dir models
# text β video
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/Wan2_2-TI2V-5B-Turbo-Q8_0.gguf \
--video-text-encoder models/umt5-xxl-encoder-Q8_0.gguf --video-vae models/VAE/Wan2.2_VAE.safetensors \
--prompt "A red fox trotting through falling snow, cinematic" \
--video-frames 81 --fps 24 --output out.mp4 --backend ggml_cuda
# image β video (the image becomes the first frame; Wan 2.2 models only)
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/Wan2_2-TI2V-5B-Turbo-Q8_0.gguf \
--video-text-encoder models/umt5-xxl-encoder-Q8_0.gguf --video-vae models/VAE/Wan2.2_VAE.safetensors \
--image first_frame.png --prompt "the camera pushes in as the waves rise" \
--output out.mp4 --backend ggml_cuda
dotnet TensorSharp.Server.Host/bin/TensorSharp.Server.Host.dll --model models/Wan2_2-TI2V-5B-Turbo-Q8_0.gguf \
--video-text-encoder models/umt5-xxl-encoder-Q8_0.gguf --video-vae models/VAE/Wan2.2_VAE.safetensors \
--backend ggml_cuda --video-frames 121 --fps 24
At load the console confirms the detection with step-distilled checkpoint detected -> 4 steps, guidance off (--diffusion-steps / --cfg override). Measured on an M5 Pro with ggml_metal, a 1088Γ832 Γ 121-frame (5 s, 720p-class) image-to-video request costs 100 DiT passes β 3 h 30 m on the base checkpoint and 4 passes = 17 m 30 s on the Turbo one β the same flags, the same resolution, only the --model path differs. At 480p (736Γ544 Γ 121f) the Turbo checkpoint finishes in 6 m 19 s.
To reproduce the base recipe instead β for a reference sample, or on a Wan 2.1 checkpoint that has no distilled build β swap the first download and the --model paths:
hf download QuantStack/Wan2.2-TI2V-5B-GGUF Wan2.2-TI2V-5B-Q8_0.gguf --local-dir models
# 50 steps x 2 CFG passes; --cfg-cache-stride trades a little accuracy for 1.30x / 1.43x
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll --model models/Wan2.2-TI2V-5B-Q8_0.gguf \
--video-text-encoder models/umt5-xxl-encoder-Q8_0.gguf --video-vae models/VAE/Wan2.2_VAE.safetensors \
--prompt "A red fox trotting through falling snow, cinematic" \
--video-frames 81 --fps 24 --cfg-cache-stride 2 --output out.mp4 --backend ggml_cuda
For Wan 2.2 A14B image-to-video, download both distilled experts under one --local-dir β the loader finds the low-noise partner from the high-noise file name, so only one --model path is passed. A14B uses the Wan 2.1 VAE:
hf download jayn7/WAN2.2-I2V_A14B-DISTILL-LIGHTX2V-4STEP-GGUF \
high_noise/wan2.2_i2v_A14b_high_noise_lightx2v_4step-Q4_K_M.gguf --local-dir models
hf download jayn7/WAN2.2-I2V_A14B-DISTILL-LIGHTX2V-4STEP-GGUF \
low_noise/wan2.2_i2v_A14b_low_noise_lightx2v_4step-Q4_K_M.gguf --local-dir models
hf download QuantStack/Wan2.2-I2V-A14B-GGUF VAE/Wan2.1_VAE.safetensors --local-dir models
dotnet TensorSharp.Cli/bin/TensorSharp.Cli.dll \
--model models/high_noise/wan2.2_i2v_A14b_high_noise_lightx2v_4step-Q4_K_M.gguf \
--video-text-encoder models/umt5-xxl-encoder-Q8_0.gguf --video-vae models/VAE/Wan2.1_VAE.safetensors \
--image first_frame.png --prompt "the camera pushes in as the waves rise" \
--output out.mp4 --backend ggml_cuda
Generate at a resolution Wan was trained at. Wan is trained at 480p (832Γ480) and 720p (1280Γ704), and TI2V-5B is natively a 720p model. Below ~0.3 MP the DiT is out of distribution and the video gets soft, unstable and color-drifting no matter how many steps you spend β the pipeline warns when you cross that line. Generate at 480p and downscale afterwards rather than generating small.
Wan companions, cost and resolution
Wan turns a prompt β and, on the Wan 2.2 checkpoints, an uploaded first frame β into an H.264 MP4. The --model GGUF is only the DiT; TensorSharp resolves two companions next to it (a VAE/, HighNoise/ or LowNoise/ subfolder is fine):
- UMT5-XXL text encoder β prompt β conditioning (
--video-text-encoder/TS_VIDEO_TEXT_ENCODER). Released from VRAM before the denoise starts. - Causal 3D video VAE β latent β frames (
--video-vae/TS_VIDEO_VAE). Which one is required is read off the DiT itself, not chosen by you: Wan 2.1 and A14B usewan_2.1_vae; TI2V-5B usesWan2.2_VAE. - The A14B second expert β the two 14B experts must both be present. Put them in one directory, or in
HighNoise/+LowNoise/subdirectories, and the loader pairs them from the file names (--video-dit2on the CLI or the server, orTS_VIDEO_DIT2, overrides).
| Family | Latent | Modes | Notes |
|---|---|---|---|
| Wan 2.1 T2V (1.3B / 14B) | 16 ch, 8Γ8Γ4 | text β video | single DiT |
| Wan 2.2 TI2V-5B | 48 ch, 16Γ16Γ4 | text β video, image β video | dense 5B, 24 fps, 720p-capable |
| Wan 2.2 A14B (T2V / I2V) | 16 ch (36 ch I2V input) | text β video, image β video | two 14B experts switched at a timestep boundary |
Each denoise step is one resident-weight ggml graph (CUDA-graph-captured, flash attention, per-token-timestep modulation for TI2V image-to-video); the video VAE encode and decode are each a single graph. The stages hand VRAM over in sequence β text encoder, then DiT, then VAE β so peak usage is roughly max(TE, DiT + attention, VAE): TI2V-5B generates 81-frame 480p image-to-video on a 16 GB GPU in under 8 minutes, and both A14B experts run sequentially on the same card. Numerics are verified against diffusers (DiT cosine > 0.995, VAE encoders > 0.999, decode 59.9 dB PSNR), and Wan 2.1 runs 6.0Γ faster end-to-end than stable-diffusion.cpp on the identical workload.
The checkpoint decides the wall clock
Wan's DiT token count is latent_frames Γ (h/2) Γ (w/2) and self-attention costs O(tokensΒ²), so a 5-second 720p video is a genuinely large job: 1088Γ832 Γ 121 frames is 27 404 tokens, and the official TI2V-5B recipe spends 50 steps Γ 2 classifier-free-guidance passes = 100 DiT passes on it. A step-distilled checkpoint is trained to run guidance-free in 4 steps, so the same video costs 4 passes β 1/25th of the denoising work. TensorSharp detects one from the DiT file name (turbo, distill, lightning, lightx2v, fastwan, -dmd, or an explicit β¦-4steps-β¦ for 1β16 steps), prints step-distilled checkpoint detected -> 4 steps, guidance off at load, and applies the recipe itself; --diffusion-steps and --cfg still override.
M5 Pro, ggml_metal, TI2V-5B Q8_0, 1088Γ832 Γ 121f (27 404 tokens, image β video) | Base, before | Base, now | Turbo, now |
|---|---|---|---|
| DiT passes | 100 (50 steps Γ CFG) | 100 | 4 (guidance-free) |
| per pass | 206.2 s | 120.2 s | 120.2 s |
| denoise total | 20 615 s | 12 020 s | 481 s |
| VAE decode, 121 frames | 863 s | 563 s | 563 s |
| end to end | β 5 h 58 m | β 3 h 30 m | 17 m 30 s |
The two levers are independent: ~1.7Γ per pass from keeping the DiT's flash-attention keys and values in F16 (2.02Γ on a single 27 k-token self-attention, at cosine 0.999964 against the diffusers reference β TS_WAN_DIT_KV_F16=0 restores F32) and from running the Metal VAE convolutions through MPSGraph instead of ggml's im2col+GEMM lowering (VAE decode 159 s β 80 s at 736Γ544 Γ 81f, numerics unchanged at 93.9 dB PSNR β TS_WAN_VAE_MPS_CONV=0 reverts), and 25Γ fewer passes from the distilled checkpoint. Once distilled, the VAE decode is the bottleneck at ~55% of the run, not the DiT.
Frames and resolution set the rest
| Output (M5 Pro, same Turbo checkpoint and image) | Tokens | Denoise | VAE decode | Total |
|---|---|---|---|---|
| 736Γ544 Γ 81f (3.4 s, 480p class) | 8 211 | 84 s | 159 s | 4 m 09 s |
| 736Γ544 Γ 121f (5 s, 480p class) | 12 121 | 137 s | 237 s | 6 m 19 s |
| 1088Γ832 Γ 121f (5 s, 720p class) | 27 404 | 481 s | 563 s | 17 m 30 s |
480p (β0.4 MP) is a resolution Wan is trained at, so the first two rows are in-distribution rather than a degraded mode β that is the setting to reach for when a few minutes matters. Quality falls off below ~0.3 MP, where the DiT is out of distribution and the video turns soft, unstable and color-drifting however many steps you spend; the pipeline prints a warning when you cross that line. Generate at a supported resolution and downscale afterwards (--width 480 --height 704 rather than 320Γ480).
To make a large request cheaper, in order of effect: (1) use a step-distilled checkpoint β 100 passes become 4, dwarfing everything else; (2) fewer frames β 121 β 61 roughly quarters the attention work and halves the VAE decode; (3) a smaller frame area, but not below ~0.3 MP; (4) fewer steps, on base checkpoints only β 30 instead of 50 is visibly close and 1.7Γ cheaper; (5) --cfg-cache-stride 2 or 3, which runs the unconditional pass on one step in N and reuses the cached guidance direction between β 77 of the 100 passes (1.30Γ) or 70 (1.43Γ) at 50 steps. It is an approximation, so leave it off when matching a reference sample matters, and it does nothing on a distilled checkpoint, which is already guidance-free.
On NVIDIA, ggml_cuda is the fastest Wan backend: on an RTX 2000 Ada 16 GB running the official 480p Wan2.1-1.3B recipe it takes 12.0 s/step against ggml_vulkan's 17.2 and the direct cuda backend's 19.3. Wan does not run on mlx at all, and the cpu / ggml_cpu backends are for functional use only.
Drive it from the CLI (--prompt, optional --image, --video-frames, --fps, --flow-shift, --sampler, --negative-prompt), the HTTP API (/v1/videos/generations), or the Web UI chat with an image upload. On the server, --video-frames and --fps set defaults rather than caps β a request carrying its own frames or fps overrides them independently, and with both omitted the model's own recipe applies (49 frames at 24 fps for Wan2.2-TI2V, 33 at 16 fps otherwise). Frame counts snap to the VAE's temporal grid (4k+1). Full details are in the repository's docs/models/wan.md card.