{"id":28447,"library":"vsa","title":"VSA - Video Sparse Attention Kernel","description":"VSA (Video Sparse Attention) is a CUDA kernel for efficient sparse attention in video diffusion models, part of the FastVideo library. Current version 0.0.5 (PyPI) and 0.1.7 (GitHub release). Development is active with frequent releases. Requires Python >=3.10 and CUDA toolkit.","status":"active","version":"0.1.7","language":"python","source_language":"en","source_url":"https://github.com/hao-ai-lab/FastVideo/tree/main/csrc/attn/video_sparse_attn","tags":["video","attention","sparse","cuda","fastvideo"],"install":[{"cmd":"pip install vsa","lang":"bash","label":"PyPI Install"}],"dependencies":[{"reason":"VSA is a PyTorch extension","package":"torch","optional":false},{"reason":"Requires nvcc to compile CUDA kernels","package":"CUDA Toolkit","optional":false}],"imports":[{"note":"The PyPI package name is vsa, and the module is also vsa. The CUDA source lives under csrc/attn/video_sparse_attn but the Python package is just vsa.","wrong":"from video_sparse_attn import ...","symbol":"vsa","correct":"import vsa"}],"quickstart":{"code":"import torch\nimport vsa\n\n# Create query, key, value tensors (batch, heads, seq_len, dim)\nq = torch.randn(1, 8, 1024, 64, device='cuda')\nk = torch.randn(1, 8, 1024, 64, device='cuda')\nv = torch.randn(1, 8, 1024, 64, device='cuda')\n\n# Sparse attention using VSA\noutput = vsa.video_sparse_attn(q, k, v)\nprint(output.shape)","lang":"python","description":"Basic usage of VSA for sparse video attention."},"warnings":[{"fix":"Install directly from GitHub or wait for a new PyPI release: pip install git+https://github.com/hao-ai-lab/FastVideo.git#subdirectory=csrc/attn/video_sparse_attn","message":"PyPI version 0.0.5 is outdated and may have API incompatibilities with the latest GitHub releases.","severity":"breaking","affected_versions":"<0.1.x"},{"fix":"Ensure nvcc is in PATH and torch is CUDA-enabled.","message":"VSA requires a CUDA-compatible GPU and the CUDA Toolkit to be installed. Without it, import will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Update your code to use the new API if present, or stay on v0.0.5.","message":"The 'v0' code paths were removed in release v0.1.2. If you rely on any v0 features, upgrade carefully.","severity":"deprecated","affected_versions":">=0.1.2"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run: pip install vsa","cause":"VSA not installed or installed incorrectly.","error":"ModuleNotFoundError: No module named 'vsa'"},{"fix":"Set environment variable TORCH_CUDA_ARCH_LIST before installation, e.g., export TORCH_CUDA_ARCH_LIST=\"8.0\" for Ampere.","cause":"VSA kernel compiled for a different CUDA architecture than the GPU supports.","error":"RuntimeError: CUDA error: no kernel image is available for execution on the device"},{"fix":"Install NVIDIA drivers and ensure LD_LIBRARY_PATH includes CUDA library path.","cause":"CUDA driver library not found.","error":"ImportError: libcuda.so: cannot open shared object file"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}