MagCache4FramePack
June 22, 2025 ยท View on GitHub
MagCache can speedup FramePack 2.25x and FramePack-F1 2.45x without much visual quality degradation, in a training-free manner. The following video shows the results generated by MagCache-FramePack.
- FramePack demo

Prompt: The girl dances gracefully, with clear movements, full of charm.
The girl dances gracefully, with clear movements, full of charm.- FramePack-F1 demo

Prompt: The girl dances gracefully, with clear movements, full of charm.
The girl dances gracefully, with clear movements, full of charm.๐ Inference Latency Comparisons on a Single L20 GPU
| Model | Original | TeaCache | MagCache (E010K3R02) | MagCache (E015K4R02) |
|---|---|---|---|---|
| FramePack 5s | 9min | 4min40s | 4min20s | 4min |
| FramePack-F1 5s | 9min | 4min | 4min20s | 3min40s |
Usage
Follow FramePack to clone the repo and finish the installation, then copy 'magcache_demo_gradio.py' and 'magcache_demo_gradio_f1.py' in this repo to the FramePack repo. You can modify the 'magcache_thresh', 'magcache_K', and 'retention_ratio' in the web UI to obtain your desired trade-off between latency and visul quality.
# FramePack
python magcache_demo_gradio.py
# FramePack-F1
python magcache_demo_gradio_f1.py
If you want to recalibrate the mag_ratios in the function initialize_magcache, please replace magcache_framepack_forward in line 527 of magcache_demo_gradio.py with magcache_framepack_calibration and run the gradio demo with magcache. The mag_ratios will be printed in the shell.
Citation
If you find MagCache is useful in your research or applications, please consider giving us a star ๐ and citing it by the following BibTeX entry.
@misc{ma2025magcachefastvideogeneration,
title={MagCache: Fast Video Generation with Magnitude-Aware Cache},
author={Zehong Ma and Longhui Wei and Feng Wang and Shiliang Zhang and Qi Tian},
year={2025},
eprint={2506.09045},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2506.09045},
}
Acknowledgements
We would like to thank the contributors to the FramePack and TeaCache.