Video-to-Video
Diffusers
Safetensors
SwiftVR / README.md
nielsr's picture
nielsr HF Staff
Add pipeline tag, library name and metadata
bbc1f18 verified
|
Raw
History Blame
5.05 kB
---
license: apache-2.0
pipeline_tag: image-to-image
library_name: diffusers
---
<h1 align="center">SwiftVR: Real-Time One-Step Generative Video Restoration</h1>
<p align="center"><img src="https://huggingface.co/H-oliday/SwiftVR/resolve/main/assets/teaser.avif" width="100%" alt="SwiftVR teaser"></p>
> **SwiftVR** is the first generative video restoration model to reach **real-time 1080p streaming on a consumer-grade GPU** (โ‰ˆ26 FPS on a single RTX 5090), sustains **31 FPS at QHD (2560ร—1440)** and **14 FPS at 4K (3840ร—2160)** on a single H100, and streams at resolutions where every compared diffusion-based VR baseline runs out of memory.
<p>
<a href="https://arxiv.org/abs/2606.09516"><img src="https://img.shields.io/badge/arXiv-2606.09516-b31b1b.svg?style=flat-square" alt="arXiv"></a>
<a href="https://h-oliday.github.io/SwiftVR"><img src="https://img.shields.io/badge/Project-Page-1f8acb.svg?style=flat-square" alt="Project Page"></a>
<a href="https://github.com/H-oliday/SwiftVR">
<img src="https://img.shields.io/badge/GitHub-Code-181717.svg?style=flat-square&logo=github" alt="GitHub">
</a>
<a href="https://github.com/H-oliday/SwiftVR/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-green.svg?style=flat-square" alt="License"></a>
</p>
SwiftVR is a streaming one-step generative video restoration (VR) framework presented in [SwiftVR: Real-Time One-Step Generative Video Restoration](https://arxiv.org/abs/2606.09516).
## Updates
- [2026/06] Release the inference code and pretrained weights ๐ŸŽ‰
## โœจ Highlights
- **Mask-free shifted-window self-attention (MFSWA).** Each spatial window is **pre-gathered into a dense tensor**, so every attention call reduces to a single standard scaled-dot-product (SDPA) call โ€” *no attention mask, cyclic shift, or padding ever enters the graph*. This gives a **1.62ร— throughput gain over its full-attention teacher** at essentially identical quality, with **no dedicated sparse kernel**.
- **Restoration-aware Autoencoder (ReAE).** A lightweight encoderโ€“decoder jointly fine-tuned with the DiT in pixel space removes the heavy-3D-VAE / tiled-decoding bottleneck.
- **Causal chunk-wise streaming.** A minimal causal protocol (no rolling KV cache, no overlapped DiT inference) bounds the temporal axis, confining the residual \(\mathcal{O}(N^2)\) cost to the spatial axes.
## ๐Ÿ“Š Results
### Efficiency at 2560ร—1440 (single H100, causal streaming, 24 frames)
| Metric | DOVE (tile) | SeedVR2-3B (tile)| FlashVSR-Tiny | **SwiftVR (Ours)** |
|---|:---:|:---:|:---:|:---:|
| Avg. Time (s) โ†“ | 27.615 | 17.320 | 2.493 | 0.766 |
| FPS โ†‘ | 0.85 | 1.39 | 9.61 | 31.32 |
| Peak Mem. (GB) โ†“ | 59.24 | 35.35 | 34.35 | 38.01 |
> At **3840ร—2160**, every compared diffusion-based VR baseline **OOMs** on a single H100; SwiftVR sustains **14 FPS**.
## ๐Ÿ›  Installation
```bash
git clone https://github.com/H-oliday/SwiftVR.git
cd SwiftVR
conda create -n swiftvr python=3.10 -y
conda activate swiftvr
# Install PyTorch matching your CUDA toolkit first, e.g. CUDA 12.4:
pip install torch==2.10.0 torchvision==0.25.0 --index-url https://download.pytorch.org/whl/cu124
# Install SwiftVR (editable) and its dependencies:
pip install -e .
```
## ๐Ÿš€ Quick Start
### Python API
```python
from swiftvr import SwiftVRPipeline
pipe = SwiftVRPipeline.from_pretrained("H-oliday/SwiftVR").to("cuda", dtype="bfloat16")
pipe.restore_video("low_quality.mp4", "restored.mp4", upscale=4)
```
### Streaming (causal, chunk by chunk)
```python
session = pipe.stream(clip_len=24, resolution=(1920, 1080))
for lq_chunk in read_chunks("low_quality.mp4", n=24): # lq_chunk: [T, H, W, 3] uint8
hq = session.step(lq_chunk) # [1, T', 3, H', W'] in [0, 1], or None if buffered
if hq is not None:
write(hq)
tail = session.flush() # flush the final buffered frames
```
### Command line
```bash
python scripts/inference.py \
--input low_quality.mp4 \
--output restored.mp4 \
--checkpoint H-oliday/SwiftVR \
--upscale 4 \
--clip-len 24 \
--dtype bfloat16
```
## ๐ŸŽฌ Visual Results
<video src="https://huggingface.co/H-oliday/SwiftVR/resolve/main/assets/demo_1.mp4" controls width="100%"></video>
## ๐Ÿ™ Acknowledgements
SwiftVR builds on [Wan2.2-TI2V-5B](https://github.com/Wan-Video), the lightweight autoencoder [TAEHV](https://github.com/madebyollin/taehv), and the [RealBasicVSR](https://github.com/ckkelvinchan/RealBasicVSR) degradation pipeline. We thank the authors of [DOVE](https://github.com/zhengchen1999/DOVE), [SeedVR2](https://github.com/ByteDance-Seed/SeedVR), and [FlashVSR](https://github.com/OpenImagingLab/FlashVSR) for releasing strong baselines.
## ๐Ÿ“œ Citation
```bibtex
@article{yan2026swiftvr,
title={SwiftVR: Real-Time One-Step Generative Video Restoration},
author={Yan, Jiaqi and Chen, Xiangyu and Zhong, Xinlin and Huang, Haibin and Zhang, Chi and Liu, Jie and Zhou, Jiantao and Li, Xuelong},
journal={arXiv preprint arXiv:2606.09516},
year={2026}
}
```