Wan 2.2
Wan-AI
Wan 2.2 is a state-of-the-art text-to-video model from Wan AI, capable of generating high-quality videos up to 81 frames at 480x480 resolution.
Python usage
Overview
ElasticModels are the models produced by TheStage AI ANNA: Automated Neural Networks Accelerator. ANNA allows you to control model size, latency and quality with a simple slider movement, routing different compression algorithms to different layers. For each model, we have produced a series of optimized models:
S: The fastest model, with accuracy degradation less than 2%.
Models can be accessed via TheStage AI Python SDK: ElasticModels.
Installation
System Requirements
| Property | Value |
|---|---|
| GPU | H100, B200 |
| Python Version | 3.10-3.12 |
| CPU | Intel/AMD x86_64 |
| CUDA Version | 12.8+ |
TheStage AI Access token setup
Install TheStage AI CLI and setup API token:
pip install thestage thestage config set --access-token <YOUR_ACCESS_TOKEN>
ElasticModels installation
Install TheStage Elastic Models package:
pip install thestage
pip install 'thestage-elastic-models[nvidia]' \
--extra-index-url https://thestage.jfrog.io/artifactory/api/pypi/pypi-thestage-ai-production/simple
# pip install cache-dit==1.2.0 - for caching
pip install diffusers==0.35.1 transformers==4.52.3
pip uninstall apex
pip install opencv-python==4.11.0.86 imageio-ffmpeg==0.6.0 imageio ftfy
pip install hf_transferUsage example
Elastic Models provides the same interface as HuggingFace Diffusers. To infer our models, just replace diffusers import with elastic_models.diffusers. Here is an example of how to use the Wan2.2-T2V-A14B model:
import torch
from elastic_models.diffusers import WanPipeline
from diffusers.utils import export_to_video
model_name = 'Wan-AI/Wan2.2-T2V-A14B-Diffusers'
device = torch.device("cuda")
dtype = torch.bfloat16
pipe = WanPipeline.from_pretrained(
model_name,
torch_dtype=dtype,
# 'original' for original model
# 'S' for accelerated model
mode='S',
# use_cache=True, # enables cache-dit acceleration
)
pipe.to(device)
prompt = "A beautiful woman in a red dress dancing"
with torch.no_grad():
output = pipe(
prompt=prompt,
negative_prompt="",
height=480,
width=480,
num_frames=81,
num_inference_steps=40,
guidance_scale=3.0,
guidance_scale_2=2.0,
generator=torch.Generator("cuda").manual_seed(42),
)
video = output.frames[0]
export_to_video(video, "output.mp4", fps=16)Compiled versions are currently available only for 81-frame generations at 480x480 resolution. Other versions are not yet accessible. Stay tuned for updates!