Skip to main content

Plug-and-play sparse attention for video diffusion models

Project description

SparseVideo Logo

A one-line, plug-and-play sparse attention framework for accelerating video diffusion inference.

๐Ÿ“ฆ Installation

From PyPI

pip install sparsevideo --no-build-isolation

From source

git clone https://github.com/Mutual-Luo/SparseVideo.git
cd SparseVideo
MAX_JOBS=8 pip install -e . --no-build-isolation

๐Ÿš€ Quick Start

  import torch
  from diffusers import WanPipeline
  import sparsevideo

  pipe = WanPipeline.from_pretrained("Wan-AI/Wan2.1-T2V-14B-Diffusers", torch_dtype=torch.bfloat16)
  pipe.to("cuda")

+ pipe = sparsevideo.replace_attention(pipe, method="svoo")

  video = pipe("A cat playing piano", num_frames=81, num_inference_steps=50).frames[0]

โšก Supported Sparse Attention Methods

Method Method Method
โœ… Dense (baseline) โœ… SpargeAttn [paper] โœ… Adacluster [paper]
โœ… SVG1 [paper] โœ… Radial [paper] โœ… SVOO [paper]
โœ… SVG2 [paper] โœ… STA [paper] โœ… FlashOmni [paper]
โœ… SVG-EAR [paper] โœ… DraftAttention [paper]

๐Ÿงฉ Supported Frameworks

Works as a drop-in, one-line replacement for both Diffusers and DiffSynth-Studio pipelines. Just call sparsevideo.replace_attention(pipe, method=...), no model modifications required.

Diffusers

Supported 34 models:

Model Model Model
โœ… Wan 2.1 Text-to-Video 1.3B โœ… Wan 2.2 Text-to-Video A14B โœ… Video-as-Prompt Wan 2.1 14B
โœ… Wan 2.1 Text-to-Video 14B โœ… Wan 2.2 Image-to-Video A14B โœ… HunyuanVideo Text-to-Video
โœ… Wan 2.1 Image-to-Video 14B โœ… Wan 2.2 Speech-to-Video 14B โœ… HunyuanVideo Image-to-Video
โœ… Wan 2.1 VACE 1.3B โœ… Wan 2.2 Animate 14B โœ… CogVideoX Text-to-Video
โœ… Wan 2.1 VACE 14B โœ… Wan 2.2-Fun A14B Control โœ… CogVideoX Image-to-Video
โœ… Wan 2.1-Fun 1.3B Control โœ… Wan 2.2-Fun A14B Control-Camera โœ… EasyAnimate V5 Text-to-Video 12B
โœ… Wan 2.1-Fun 1.3B InP โœ… SkyReels-V2 Text-to-Video 14B โœ… LTX-Video Text-to-Video
โœ… Wan 2.1-Fun V1.1 1.3B Control โœ… SkyReels-V2 Image-to-Video 14B โœ… LTX-Video Image-to-Video
โœ… Wan 2.1-Fun V1.1 1.3B Control-Camera โœ… MoVA 720P โœ… LTX-2
โœ… Wan 2.1-Fun V1.1 14B Control โœ… LongCat-Video โœ… Mochi-1
โœ… Wan 2.1-Fun V1.1 14B Control-Camera โœ… Krea Realtime Video 14B โœ… Allegro
โœ… Wan 2.1 Speed-Control 1.3B

DiffSynth-Studio

Supported 30 models:

Model Model Model
โœ… Wan 2.1 Text-to-Video 1.3B โœ… Wan 2.1-Fun V1.1 1.3B Control โœ… Wan 2.2 Animate 14B
โœ… Wan 2.1 Text-to-Video 14B โœ… Wan 2.1-Fun V1.1 1.3B Control-Camera โœ… Wan 2.2 Dancer 14B
โœ… Wan 2.1 Image-to-Video 14B 480P โœ… Wan 2.1-Fun V1.1 14B Control โœ… Wan 2.2-Fun A14B Control
โœ… Wan 2.1 Image-to-Video 14B 720P โœ… Wan 2.1-Fun V1.1 14B Control-Camera โœ… Wan 2.2-Fun A14B Control-Camera
โœ… Wan 2.1 First-Last-Frame-to-Video 14B 720P โœ… Wan 2.1 VACE 1.3B โœ… LongCat-Video
โœ… Wan 2.1 Speed-Control 1.3B โœ… Wan 2.1 VACE 14B โœ… Video-as-Prompt Wan 2.1 14B
โœ… Wan 2.1-Fun 1.3B Control โœ… Wan 2.2 Text-to-Video A14B โœ… Krea Realtime Video 14B
โœ… Wan 2.1-Fun 1.3B InP โœ… Wan 2.2 Image-to-Video A14B โœ… MoVA 720P
โœ… Wan 2.1-Fun 14B Control โœ… Wan 2.2 Text/Image-to-Video 5B โœ… LTX-2
โœ… Wan 2.1-Fun 14B InP โœ… Wan 2.2 Speech-to-Video 14B โœ… LTX-2.3

๐Ÿ“„ License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparsevideo-0.1.0.tar.gz (3.2 MB view details)

Uploaded Source

File details

Details for the file sparsevideo-0.1.0.tar.gz.

File metadata

  • Download URL: sparsevideo-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for sparsevideo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a55a81da2eecebdde412ea7c261b29d30c4f6dedee6fe1e7489ae4e801bec31
MD5 5d9d3e622cf9786c74b5012a1f3ffa5f
BLAKE2b-256 7dcf81a4d8f7a57fe50527cb6af48b436ebe8cd80620e968461270b329220c85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page