2026-02-23 01:08:03 +00:00
2026-02-19 14:23:32 -08:00
2026-02-23 00:54:48 +00:00
2026-02-21 17:15:42 -08:00
2026-02-23 00:54:48 +00:00
2026-02-23 00:54:48 +00:00
2026-02-21 17:15:42 -08:00
2026-02-21 16:06:55 -08:00
2026-02-10 01:11:17 -08:00
2025-02-20 11:33:58 -08:00
2026-02-19 14:23:32 -08:00
2026-02-21 17:15:42 -08:00
2026-02-23 01:08:03 +00:00
2025-11-27 00:37:03 -08:00

Sliding Tile Attention (STA) Branch

This branch is a stash/testing branch for people who want to try Sliding Tile Attention (STA). The top-level README is intentionally STA-only.

What is STA

Sliding Tile Attention is an optimized attention backend for window-based video generation.

Setup

Install FastVideo from source:

uv pip install -e .

Build the STA kernel package:

cd fastvideo-kernel
./build.sh
cd ..

Run STA Inference

STA backend:

export FASTVIDEO_ATTENTION_BACKEND=SLIDING_TILE_ATTN

Ready-to-run examples:

  • HunyuanVideo: scripts/inference/v1_inference_hunyuan_STA.sh
  • Wan2.1-T2V-14B: scripts/inference/v1_inference_wan_STA.sh

Run:

bash scripts/inference/v1_inference_hunyuan_STA.sh
# or
bash scripts/inference/v1_inference_wan_STA.sh

Both scripts already set STA-related env vars:

  • FASTVIDEO_ATTENTION_BACKEND=SLIDING_TILE_ATTN
  • FASTVIDEO_ATTENTION_CONFIG to an STA mask strategy JSON

STA Mask Strategy Files

  • HunyuanVideo config: assets/mask_strategy_hunyuan.json
  • Wan config: assets/mask_strategy_wan.json

STA Mask Search (Wan2.1-T2V-14B)

Run mask search + tuning from repo root:

bash examples/inference/sta_mask_search/inference_wan_sta.sh

What this script does:

  • Runs STA_searching first.
  • Runs STA_tuning next (skip_time_steps=12 by default).
  • Uses prompt shards from assets/prompt_0.txt to assets/prompt_7.txt.

Important notes:

  • Default script is set to 8 GPUs (num_gpu=8). If needed, edit examples/inference/sta_mask_search/inference_wan_sta.sh.
  • STA searching/tuning currently supports 69x768x1280 (Wan setting).

Generated files:

  • Search results: output/mask_search_result_pos_1280x768/
  • Tuned strategy: output/mask_search_strategy_1280x768/mask_strategy_s12.json

Use the tuned mask for STA inference:

export FASTVIDEO_ATTENTION_BACKEND=SLIDING_TILE_ATTN
export FASTVIDEO_ATTENTION_CONFIG=output/mask_search_strategy_1280x768/mask_strategy_s12.json
python examples/inference/sta_mask_search/wan_example.py --STA_mode STA_inference --num_gpus 1

Citation

@article{zhang2025fast,
  title={Fast video generation with sliding tile attention},
  author={Zhang, Peiyuan and Chen, Yongqi and Su, Runlong and Ding, Hangliang and Stoica, Ion and Liu, Zhengzhong and Zhang, Hao},
  journal={arXiv preprint arXiv:2502.04507},
  year={2025}
}
S
Description
No description provided
Readme
437 MiB
Languages
Python 89.4%
TypeScript 5.7%
Cuda 2%
C++ 1.1%
Shell 0.7%
Other 1.1%