Instructions to use batteryphil/Wan2.2-TI2V-5B-PRIME-Quant with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Wan2.2
How to use batteryphil/Wan2.2-TI2V-5B-PRIME-Quant with Wan2.2:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Diffusers
How to use batteryphil/Wan2.2-TI2V-5B-PRIME-Quant with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image, export_to_video # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("batteryphil/Wan2.2-TI2V-5B-PRIME-Quant", dtype=torch.bfloat16, device_map="cuda") pipe.to("cuda") prompt = "A man with short gray hair plays a red electric guitar." image = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png" ) output = pipe(image=image, prompt=prompt).frames[0] export_to_video(output, "output.mp4") - Notebooks
- Google Colab
- Kaggle
Wan 2.2 TI2V-5B β PRIME-Quant (100% V3_P4_0, Zero CPU Offload)
A 100% 4-bit Prime-Harmonic (V3_P4_0) quantization of Wan-AI/Wan2.2-TI2V-5B-Diffusers (5.0B 3D DiT + 5.68B UMT5-XXL, upstream Apache-2.0) supporting both Text-to-Video (T2V) and Image-to-Video (I2V) β built with PRIME-Quant (@batteryphil).
Compresses the entire ~21.4 GB BF16 Wan 2.2 TI2V-5B stack down to 6.01 GB on disk (3.56Γ compression) β running 100% GPU-resident with zero CPU offload (7.27 GB resident VRAM, 9.73 GB peak with tiled BF16 AutoencoderKLWan) on a single 12β16 GB AMD ROCm or NVIDIA CUDA GPU, faster than BF16 CPU-offload.
Verified Benchmark Results (AMD RX 9060 XT 16 GB, ROCm 7.2)
All measurements freshly executed at 832Γ480, 33 frames (16 fps), 24 steps, CFG 5.0, identical tiled BF16 AutoencoderKLWan (benchmarks/wan22_bf16_vs_prime_benchmark.json):
| Metric | BF16 Baseline (Model CPU Offload) | PRIME-Quant (100% V3_P4_0, Zero CPU Offload) |
|---|---|---|
| Compressed Weights on Disk | ~21.4 GB |
6.01 GB (3.20 GB UMT5-XXL + 2.82 GB 5B DiT β 3.56Γ smaller) |
| Quantized Weight Coverage | 0 / 476 |
476 / 476 (100%) (169/169 UMT5-XXL + 307/307 3D DiT) |
| Total GPU-Resident Footprint | Cannot fit on 16 GB | 7,265.2 MB (UMT5-XXL + 5B 3D DiT + VAE all resident) |
Peak PyTorch VRAM (832Γ480, 33f) |
11,076.4 MB |
9,730.1 MB (zero CPU offload!) |
| Mean T2V Render Time (33f, 24 steps) | 101.25 s |
88.07 s (1.15Γ faster) |
| I2V Render Time (33f, 24 steps) | 257.41 s |
88.49 s (2.91Γ faster) |
| I2V Frame-0 Anchoring Parity | Reference | 99.9 dB PSNR / 1.0000 SSIM (zero first-frame pop!) |
| I2V All-33-Frame Parity (BF16 vs. P4_0) | Reference | 29.37 dB mean PSNR / 0.9849 mean SSIM |
Visual Parity (Top Row = BF16 Teacher, Bottom Row = 100% PRIME-Quant V3_P4_0)
Image-to-Video (End-to-End FLUX.1-schnell PRIME-Quant β Wan 2.2 TI2V-5B PRIME-Quant, 29.37 dB / 0.9849 SSIM):

Text-to-Video (832Γ480, 33 frames, 24 steps):

Quantization Architecture Highlights
- 100%
V3_P4_0Group-32 Prime-Harmonic Codebook: Zero BF16 weights in eitherUMT5-XXL(including 16K-row streamed[256384, 4096]sharedvocab embedding) or the5.0BWanTransformer3DModel(22.58 dBmean /22.15 dBfloor weight SNR across all 30 3D DiT blocks). - Exact Zero-Overhead
H_64/H_128Walsh-Hadamard Rotations:sa.v <-> sa.oin all 24UMT5-XXLblocks (with FP32 on-the-fly unpack protection onwo), plusto_v <-> to_out.0in both self-attention and cross-attention across all 30WanTransformerBlocks. - 4,096-Timestep Frame-0 Anchored
PRIMAL+ Co-Adaptedtext_embedder:time_embedder + time_projcalibrated acrosst=0Frame-0 anchor +[0..1000]reaches53.72 dBSNR, preserving Frame-0 I2V anchoring to99.9 dB/1.0000SSIM.- Co-Adapted
text_embedderKroneckerPRIMALmaps 4-bitUMT5-XXLdirectly onto the BF16 Teachertext_embedder.
- RDNA4 / 16 GB Tiled BF16 VAE Tip: Always keep
vae.enable_tiling()withbfloat16onAutoencoderKLWan(29.5 s/4.07 GBpeak vs.10.46 GBuntiled on ROCm 7.2).
Quickstart (Standalone β Zero Extra Repos Required)
pip install -r requirements.txt
# Text-to-Video (T2V):
TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 \
python run_wan22_prime.py \
--prompt "Cinematic aerial drone glide over a mirror-calm alpine lake at golden sunrise, snow-capped peaks" \
--width 832 --height 480 --num-frames 33 --steps 24 --seed 42 \
--output alpine_prime.mp4
# Image-to-Video (I2V):
TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 \
python run_wan22_prime.py \
--image frame0.png \
--prompt "The subject slowly turns toward the golden ocean breeze, subtle natural motion, 85mm shallow depth of field" \
--width 832 --height 480 --num-frames 33 --steps 24 --seed 77 \
--output i2v_prime.mp4
run_wan22_prime.pyautomatically downloads only the lightweight tokenizer, config, scheduler, andAutoencoderKLWanVAE fromWan-AI/Wan2.2-TI2V-5B-Diffusersβ it never downloads the21.4 GBBF16 weights.
Licensing & Attribution
- PRIME-Quant checkpoints & standalone runtime (
prime_infer_runtime.py,run_wan22_prime.py): Copyright (c) 2026 Philip Bartsch (@batteryphil), licensed under the Bartsch Personal-Free & 5% Commercial Profit-Share License v1.0 (free for personal, research, academic, and non-profit use). - Upstream Base Model (
Wan2.2-TI2V-5B): Apache License 2.0 by Wan-AI (Alibaba Tongyi Lab) β see NOTICE.
- Downloads last month
- -
Model tree for batteryphil/Wan2.2-TI2V-5B-PRIME-Quant
Base model
Wan-AI/Wan2.2-TI2V-5B-Diffusers