Instructions to use H-oliday/SwiftVR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use H-oliday/SwiftVR with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("H-oliday/SwiftVR", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<h1 align="center">SwiftVR: Real-Time One-Step Generative Video Restoration</h1>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
<p align="center"><img src="assets/teaser.avif" width="100%" alt="SwiftVR teaser"></p>
|
| 4 |
|
|
|
|
|
|
|
| 5 |
> **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.
|
| 6 |
|
| 7 |
<p>
|
|
@@ -9,24 +18,31 @@
|
|
| 9 |
<a href="https://github.com/H-oliday/SwiftVR/"><img src="https://img.shields.io/badge/Project-Page-1f8acb.svg?style=flat-square" alt="Project Page"></a>
|
| 10 |
<a href="https://huggingface.co/H-oliday/SwiftVR"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-Model-ffce00.svg?style=flat-square" alt="HuggingFace"></a>
|
| 11 |
<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>
|
|
|
|
| 12 |
</p>
|
| 13 |
|
|
|
|
|
|
|
| 14 |
## Updates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
* [2026/06] Release the inference code and pretrained weights π
|
| 17 |
|
| 18 |
## β¨ Highlights
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
|
| 25 |
## π Results
|
|
|
|
| 26 |
|
| 27 |
-
### Efficiency at 2560Γ1440
|
| 28 |
-
|
| 29 |
-
Single H100, causal streaming, 24 frames.
|
| 30 |
|
| 31 |
| Metric | DOVE (tile) | SeedVR2-3B (tile)| FlashVSR-Tiny | **SwiftVR (Ours)** |
|
| 32 |
|---|:---:|:---:|:---:|:---:|
|
|
@@ -38,12 +54,15 @@ Single H100, causal streaming, 24 frames.
|
|
| 38 |
|
| 39 |
### Qualitative comparison
|
| 40 |
|
| 41 |
-
<img src="assets/qualitative.png" width="100%" alt="SwiftVR
|
|
|
|
|
|
|
| 42 |
|
| 43 |
## π Installation
|
|
|
|
| 44 |
|
| 45 |
```bash
|
| 46 |
-
git clone https://github.com/
|
| 47 |
cd SwiftVR
|
| 48 |
|
| 49 |
conda create -n swiftvr python=3.10 -y
|
|
@@ -59,35 +78,37 @@ pip install -e .
|
|
| 59 |
<details>
|
| 60 |
<summary><b>Hardware notes</b></summary>
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
</details>
|
| 67 |
|
| 68 |
-
## π Model Zoo
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
```bash
|
| 75 |
huggingface-cli download H-oliday/SwiftVR --local-dir checkpoints/
|
| 76 |
```
|
| 77 |
|
| 78 |
-
Expected checkpoint layout
|
| 79 |
|
| 80 |
-
```
|
| 81 |
checkpoints/
|
| 82 |
-
βββ reae.safetensors
|
| 83 |
-
βββ prompt_embedding.safetensors
|
| 84 |
-
βββ transformer/
|
| 85 |
βββ config.json
|
| 86 |
βββ diffusion_pytorch_model.safetensors
|
| 87 |
```
|
| 88 |
|
| 89 |
-
## π Quick Start
|
| 90 |
|
|
|
|
|
|
|
| 91 |
### Python API
|
| 92 |
|
| 93 |
```python
|
|
@@ -108,7 +129,8 @@ Tunable knobs include:
|
|
| 108 |
* `quality`: 0β100, mapped to x265 CRF
|
| 109 |
* `queue_size`: pipeline queue size
|
| 110 |
|
| 111 |
-
|
|
|
|
| 112 |
|
| 113 |
Causal, chunk-by-chunk restoration without future frames.
|
| 114 |
|
|
@@ -116,11 +138,11 @@ Causal, chunk-by-chunk restoration without future frames.
|
|
| 116 |
session = pipe.stream(clip_len=24, resolution=(1920, 1080))
|
| 117 |
|
| 118 |
for lq_chunk in read_chunks("low_quality.mp4", n=24): # lq_chunk: [T, H, W, 3] uint8
|
| 119 |
-
hq = session.step(lq_chunk)
|
| 120 |
if hq is not None:
|
| 121 |
write(hq)
|
| 122 |
|
| 123 |
-
tail = session.flush()
|
| 124 |
```
|
| 125 |
|
| 126 |
### Command line
|
|
@@ -132,40 +154,31 @@ python scripts/inference.py \
|
|
| 132 |
--checkpoint checkpoints/ \
|
| 133 |
--upscale 4 \
|
| 134 |
--clip-len 24 \
|
| 135 |
-
--dtype bfloat16
|
| 136 |
```
|
| 137 |
|
| 138 |
Use `--png` to write a PNG sequence.
|
| 139 |
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
SwiftVR
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
βββ io.py # frame reading, GPU preprocessing, mp4 / PNG writing
|
| 155 |
-
βββ models/
|
| 156 |
-
β βββ reae.py # Restoration-aware Autoencoder
|
| 157 |
-
β βββ transformer.py # DiT + mask-free shifted-window self-attention
|
| 158 |
-
βββ streaming/
|
| 159 |
-
βββ chunk.py # fixed-size causal chunk protocol
|
| 160 |
-
βββ tae.py # streaming autoencoder with causal boundary state
|
| 161 |
-
βββ dit.py # one-step streaming DiT with fixed timestep and RoPE offsets
|
| 162 |
-
```
|
| 163 |
|
| 164 |
## π Acknowledgements
|
|
|
|
|
|
|
| 165 |
|
| 166 |
-
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.
|
| 167 |
|
| 168 |
-
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, and the [UltraVideo](https://huggingface.co/datasets/APRIL-AIGC/UltraVideo) team for the training corpus.
|
| 169 |
|
| 170 |
## π License
|
| 171 |
|
|
@@ -187,6 +200,3 @@ If you have any questions, feel free to reach out:
|
|
| 187 |
|
| 188 |
* Email: [kakibluee@gmail.com](mailto:kakibluee@gmail.com)
|
| 189 |
|
| 190 |
-
<div align="center">
|
| 191 |
-
<sub>If SwiftVR is useful to your research or product, please consider giving it a β.</sub>
|
| 192 |
-
</div>
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
<h1 align="center">SwiftVR: Real-Time One-Step Generative Video Restoration</h1>
|
| 7 |
|
| 8 |
+
|
| 9 |
+
|
| 10 |
<p align="center"><img src="assets/teaser.avif" width="100%" alt="SwiftVR teaser"></p>
|
| 11 |
|
| 12 |
+
|
| 13 |
+
|
| 14 |
> **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.
|
| 15 |
|
| 16 |
<p>
|
|
|
|
| 18 |
<a href="https://github.com/H-oliday/SwiftVR/"><img src="https://img.shields.io/badge/Project-Page-1f8acb.svg?style=flat-square" alt="Project Page"></a>
|
| 19 |
<a href="https://huggingface.co/H-oliday/SwiftVR"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-Model-ffce00.svg?style=flat-square" alt="HuggingFace"></a>
|
| 20 |
<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>
|
| 21 |
+
|
| 22 |
</p>
|
| 23 |
|
| 24 |
+
|
| 25 |
+
|
| 26 |
## Updates
|
| 27 |
+
---
|
| 28 |
+
- [2026/06] Release the inference code and pretrained weights π
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
|
|
|
|
| 33 |
|
| 34 |
## β¨ Highlights
|
| 35 |
+
---
|
| 36 |
|
| 37 |
+
- **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**.
|
| 38 |
+
- **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.
|
| 39 |
+
- **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.
|
| 40 |
|
| 41 |
|
| 42 |
## π Results
|
| 43 |
+
---
|
| 44 |
|
| 45 |
+
### Efficiency at 2560Γ1440 (single H100, causal streaming, 24 frames)
|
|
|
|
|
|
|
| 46 |
|
| 47 |
| Metric | DOVE (tile) | SeedVR2-3B (tile)| FlashVSR-Tiny | **SwiftVR (Ours)** |
|
| 48 |
|---|:---:|:---:|:---:|:---:|
|
|
|
|
| 54 |
|
| 55 |
### Qualitative comparison
|
| 56 |
|
| 57 |
+
<img src="assets/qualitative.png" width="100%" alt="SwiftVR teaser">
|
| 58 |
+
|
| 59 |
+
|
| 60 |
|
| 61 |
## π Installation
|
| 62 |
+
---
|
| 63 |
|
| 64 |
```bash
|
| 65 |
+
git clone https://github.com/Holiday/SwiftVR.git
|
| 66 |
cd SwiftVR
|
| 67 |
|
| 68 |
conda create -n swiftvr python=3.10 -y
|
|
|
|
| 78 |
<details>
|
| 79 |
<summary><b>Hardware notes</b></summary>
|
| 80 |
|
| 81 |
+
- **Server:** single H100-80G reproduces the QHD/4K numbers above.
|
| 82 |
+
- **Consumer:** single RTX 5090 reaches β26 FPS at 1080p with the *same checkpoint* (default PyTorch SDPA path, bfloat16, causal chunk protocol).
|
| 83 |
+
- No hardware-specific retraining or kernel rewrite is required on any platform.
|
|
|
|
| 84 |
</details>
|
| 85 |
|
|
|
|
| 86 |
|
| 87 |
+
|
| 88 |
+
## π Model Zoo
|
| 89 |
+
---
|
| 90 |
+
| Model Name | Date | Backbone | Link |
|
| 91 |
+
|---|---|---|---|
|
| 92 |
+
| SwiftVR | 2026.06 | Wan2.2-TI2V-5B | [π€ HuggingFace](https://huggingface.co/H-oliday/SwiftVR) |
|
| 93 |
|
| 94 |
```bash
|
| 95 |
huggingface-cli download H-oliday/SwiftVR --local-dir checkpoints/
|
| 96 |
```
|
| 97 |
|
| 98 |
+
Expected checkpoint layout (the directory passed to `from_pretrained`):
|
| 99 |
|
| 100 |
+
```
|
| 101 |
checkpoints/
|
| 102 |
+
βββ reae.safetensors # Restoration-aware Autoencoder weights
|
| 103 |
+
βββ prompt_embedding.safetensors# precomputed empty-prompt text embedding (key: "prompt_emb")
|
| 104 |
+
βββ transformer/ # diffusers-format DiT
|
| 105 |
βββ config.json
|
| 106 |
βββ diffusion_pytorch_model.safetensors
|
| 107 |
```
|
| 108 |
|
|
|
|
| 109 |
|
| 110 |
+
## π Quick Start
|
| 111 |
+
---
|
| 112 |
### Python API
|
| 113 |
|
| 114 |
```python
|
|
|
|
| 129 |
* `quality`: 0β100, mapped to x265 CRF
|
| 130 |
* `queue_size`: pipeline queue size
|
| 131 |
|
| 132 |
+
|
| 133 |
+
### Streaming (causal, chunk by chunk, no future frames)
|
| 134 |
|
| 135 |
Causal, chunk-by-chunk restoration without future frames.
|
| 136 |
|
|
|
|
| 138 |
session = pipe.stream(clip_len=24, resolution=(1920, 1080))
|
| 139 |
|
| 140 |
for lq_chunk in read_chunks("low_quality.mp4", n=24): # lq_chunk: [T, H, W, 3] uint8
|
| 141 |
+
hq = session.step(lq_chunk) # [1, T', 3, H', W'] in [0, 1], or None if buffered
|
| 142 |
if hq is not None:
|
| 143 |
write(hq)
|
| 144 |
|
| 145 |
+
tail = session.flush() # flush the final buffered frames
|
| 146 |
```
|
| 147 |
|
| 148 |
### Command line
|
|
|
|
| 154 |
--checkpoint checkpoints/ \
|
| 155 |
--upscale 4 \
|
| 156 |
--clip-len 24 \
|
| 157 |
+
--dtype bfloat16 \
|
| 158 |
```
|
| 159 |
|
| 160 |
Use `--png` to write a PNG sequence.
|
| 161 |
|
| 162 |
+
|
| 163 |
+
## π¬ More Visual Results
|
| 164 |
+
---
|
| 165 |
+
> Full-length restored clips (low-quality input β SwiftVR, played back to back).
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
<video src="https://huggingface.co/H-oliday/SwiftVR/resolve/main/assets/demo_1.mp4" controls width="100%"></video>
|
| 169 |
+
|
| 170 |
+
<video src="https://huggingface.co/H-oliday/SwiftVR/resolve/main/assets/demo_2.mp4" controls width="100%"></video>
|
| 171 |
+
|
| 172 |
+
<video src="https://huggingface.co/H-oliday/SwiftVR/resolve/main/assets/demo_3.mp4" controls width="100%"></video>
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
## π Acknowledgements
|
| 178 |
+
---
|
| 179 |
+
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, and the [UltraVideo](https://github.com/Tele-AI/UltraVideo) team for the training corpus.
|
| 180 |
|
|
|
|
| 181 |
|
|
|
|
| 182 |
|
| 183 |
## π License
|
| 184 |
|
|
|
|
| 200 |
|
| 201 |
* Email: [kakibluee@gmail.com](mailto:kakibluee@gmail.com)
|
| 202 |
|
|
|
|
|
|
|
|
|