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.
Perfomance
Latency Benchmarks
We have measured the latency of different sizes of Wan2.2-T2V-A14B model (S, original) on various GPUs. The measurements were taken for generating videos at 480x480 resolution with 81 frames.
Latency Benchmarking
Latency Benchmark Results
Latency (in seconds) for generating a 480x480 video with 81 frames on various hardware setups.
| GPU/Model Size | S | M | L | XL | Original |
|---|---|---|---|---|---|
| H100 | 90 | N/A | N/A | N/A | 180 |
| B200 | 99 | N/A | N/A | N/A | 117 |
Benchmarking Methodology
The benchmarking was performed on a single GPU with a batch size of 1. Each model was run for 5 iterations, and the average latency was calculated.
Algorithm summary:
Load the Wan2.2-T2V-A14B model with the specified size (S, original).
Move the model to the GPU.
Prepare a sample prompt for video generation.
Run the model for a number of iterations (e.g., 5) and measure the time taken for each iteration. On each iteration:
Synchronize the GPU to flush any previous operations.
Record the start time.
Generate the video using the model.
Synchronize the GPU again.
Record the end time and calculate the latency for that iteration.
Calculate the average latency over all iterations.
Reproduce benchmarking
import time
import torch
from elastic_models.diffusers import WanPipeline
model_name = 'Wan-AI/Wan2.2-T2V-A14B-Diffusers'
device = torch.device("cuda")
pipe = WanPipeline.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
mode='S'
)
pipe.vae.enable_tiling()
pipe.vae.enable_slicing()
pipe.to(device)
prompt = "A beautiful woman in a red dress dancing"
generate_kwargs = {
"prompt": prompt,
"negative_prompt": "",
"height": 480,
"width": 480,
"num_frames": 81,
"num_inference_steps": 40,
"guidance_scale": 3.0,
"guidance_scale_2": 2.0,
}
def evaluate_pipeline():
torch.cuda.synchronize()
start_time = time.time()
with torch.no_grad():
pipe(**generate_kwargs)
torch.cuda.synchronize()
return time.time() - start_time
# Warm-up
for _ in range(2):
evaluate_pipeline()
# Benchmarking
num_runs = 5
total_time = sum(evaluate_pipeline() for _ in range(num_runs))
average_latency = total_time / num_runs
print(f"Average Latency over {num_runs} runs: {average_latency} seconds")