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", torch_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 3 files
Browse files- README.md +90 -89
- assets/qualitative.png +2 -2
- assets/teaser.avif +2 -2
README.md
CHANGED
|
@@ -1,130 +1,126 @@
|
|
| 1 |
-
--
|
| 2 |
-
license: apache-2.0
|
| 3 |
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
<p align="center"><img src="assets/teaser.avif" width="100%" alt="RVR teaser"></p>
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
> **RVR** 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>
|
| 17 |
<a href="https://arxiv.org/abs/XXXX.XXXXX"><img src="https://img.shields.io/badge/arXiv-XXXX.XXXXX-b31b1b.svg?style=flat-square" alt="arXiv"></a>
|
| 18 |
-
<a href="https://github.com/H-oliday/
|
| 19 |
-
<a href="https://huggingface.co/H-oliday/
|
| 20 |
-
<a href="https://github.com/H-oliday/
|
| 21 |
-
|
| 22 |
</p>
|
| 23 |
|
| 24 |
-
|
| 25 |
-
---
|
| 26 |
## Updates
|
| 27 |
-
- [2026/06] Release the inference code and pretrained weights π
|
| 28 |
|
|
|
|
| 29 |
|
|
|
|
| 30 |
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
---
|
| 33 |
-
## β¨ Highlights
|
| 34 |
-
- **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**.
|
| 35 |
-
- **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.
|
| 36 |
-
- **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.
|
| 37 |
|
| 38 |
-
---
|
| 39 |
## π Results
|
| 40 |
-
### Efficiency at 2560Γ1440 (single H100, causal streaming, 24 frames)
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|---|:---:|:---:|:---:|:---:|
|
| 44 |
-
| Avg. Time (s) β |
|
| 45 |
-
| FPS β |
|
| 46 |
-
| Peak Mem. (GB) β |
|
| 47 |
|
| 48 |
-
> At **3840Γ2160**, every compared diffusion-based VR baseline **OOMs** on a single H100;
|
| 49 |
|
| 50 |
### Qualitative comparison
|
| 51 |
|
| 52 |
-
<img src="assets/qualitative.png" width="100%" alt="
|
| 53 |
-
|
| 54 |
|
| 55 |
-
---
|
| 56 |
## π Installation
|
|
|
|
| 57 |
```bash
|
| 58 |
-
git clone https://github.com/
|
| 59 |
-
cd
|
| 60 |
|
| 61 |
-
conda create -n
|
| 62 |
-
conda activate
|
| 63 |
|
| 64 |
# Install PyTorch matching your CUDA toolkit first, e.g. CUDA 12.4:
|
| 65 |
pip install torch==2.10.0 torchvision==0.25.0 --index-url https://download.pytorch.org/whl/cu124
|
| 66 |
|
| 67 |
-
# Install
|
| 68 |
pip install -e .
|
| 69 |
```
|
| 70 |
|
| 71 |
<details>
|
| 72 |
<summary><b>Hardware notes</b></summary>
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
</details>
|
| 78 |
|
|
|
|
| 79 |
|
| 80 |
-
---
|
| 81 |
## π Model Zoo
|
| 82 |
-
|
| 83 |
-
|
|
| 84 |
-
|
|
|
|
|
| 85 |
|
| 86 |
```bash
|
| 87 |
-
huggingface-cli download H-oliday/
|
| 88 |
```
|
| 89 |
|
| 90 |
-
Expected checkpoint layout
|
| 91 |
|
| 92 |
-
```
|
| 93 |
checkpoints/
|
| 94 |
-
βββ reae.safetensors
|
| 95 |
-
βββ prompt_embedding.safetensors# precomputed empty-prompt text embedding
|
| 96 |
-
βββ transformer/
|
| 97 |
βββ config.json
|
| 98 |
βββ diffusion_pytorch_model.safetensors
|
| 99 |
```
|
| 100 |
|
| 101 |
-
---
|
| 102 |
## π Quick Start
|
|
|
|
| 103 |
### Python API
|
| 104 |
|
| 105 |
```python
|
| 106 |
-
from
|
| 107 |
|
| 108 |
-
pipe =
|
| 109 |
|
| 110 |
pipe.restore_video("low_quality.mp4", "restored.mp4", upscale=4)
|
| 111 |
```
|
| 112 |
|
| 113 |
-
`restore_video` also accepts an image folder as input and can write a PNG sequence
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
-
### Streaming
|
|
|
|
|
|
|
| 118 |
|
| 119 |
```python
|
| 120 |
session = pipe.stream(clip_len=24, resolution=(1920, 1080))
|
| 121 |
|
| 122 |
for lq_chunk in read_chunks("low_quality.mp4", n=24): # lq_chunk: [T, H, W, 3] uint8
|
| 123 |
-
hq = session.step(lq_chunk)
|
| 124 |
if hq is not None:
|
| 125 |
write(hq)
|
| 126 |
|
| 127 |
-
tail = session.flush()
|
| 128 |
```
|
| 129 |
|
| 130 |
### Command line
|
|
@@ -136,56 +132,61 @@ python scripts/inference.py \
|
|
| 136 |
--checkpoint checkpoints/ \
|
| 137 |
--upscale 4 \
|
| 138 |
--clip-len 24 \
|
| 139 |
-
--dtype bfloat16
|
| 140 |
```
|
| 141 |
|
| 142 |
Use `--png` to write a PNG sequence.
|
| 143 |
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
---
|
| 147 |
## π Repository Structure
|
| 148 |
-
|
| 149 |
-
|
|
|
|
| 150 |
βββ README.md
|
|
|
|
| 151 |
βββ requirements.txt
|
| 152 |
βββ setup.py
|
| 153 |
βββ scripts/
|
| 154 |
-
β βββ inference.py # CLI entry point
|
| 155 |
-
βββ
|
| 156 |
-
βββ __init__.py # exports
|
| 157 |
-
βββ pipeline.py #
|
| 158 |
-
βββ runner.py # four-stage pipelined runner
|
| 159 |
βββ io.py # frame reading, GPU preprocessing, mp4 / PNG writing
|
| 160 |
βββ models/
|
| 161 |
-
β βββ reae.py #
|
| 162 |
-
β βββ transformer.py #
|
| 163 |
βββ streaming/
|
| 164 |
βββ chunk.py # fixed-size causal chunk protocol
|
| 165 |
-
βββ tae.py # streaming autoencoder
|
| 166 |
-
βββ dit.py # one-step streaming DiT
|
| 167 |
```
|
| 168 |
|
|
|
|
| 169 |
|
| 170 |
-
---
|
| 171 |
-
## π¬ More Visual Results
|
| 172 |
-
> Full-length restored clips (low-quality input β RVR, played back to back).
|
| 173 |
|
|
|
|
| 174 |
|
| 175 |
-
|
| 176 |
|
| 177 |
-
|
| 178 |
|
| 179 |
-
|
| 180 |
|
|
|
|
| 181 |
|
| 182 |
-
-
|
| 183 |
-
## π Acknowledgements
|
| 184 |
-
RVR 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 [SeedVR2](https://github.com/ByteDance-Seed/SeedVR), [DOVE](https://github.com/zhengchen1999/DOVE), 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.
|
| 185 |
|
|
|
|
| 186 |
|
| 187 |
-
---
|
| 188 |
-
## π License
|
| 189 |
-
Released under the [Apache 2.0 License](LICENSE). The Wan2.2 backbone and any third-party weights remain subject to their original licenses.
|
| 190 |
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>
|
| 8 |
<a href="https://arxiv.org/abs/XXXX.XXXXX"><img src="https://img.shields.io/badge/arXiv-XXXX.XXXXX-b31b1b.svg?style=flat-square" alt="arXiv"></a>
|
| 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 |
+
* **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**.
|
| 21 |
+
* **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.
|
| 22 |
+
* **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.
|
| 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 |
|---|:---:|:---:|:---:|:---:|
|
| 33 |
+
| Avg. Time (s) β | 27.615 | 17.320 | 2.493 | 0.766 |
|
| 34 |
+
| FPS β | 0.85 | 1.39 | 9.61 | 31.32 |
|
| 35 |
+
| Peak Mem. (GB) β | 59.24 | 35.35 | 34.35 | 38.01 |
|
| 36 |
|
| 37 |
+
> At **3840Γ2160**, every compared diffusion-based VR baseline **OOMs** on a single H100; SwiftVR sustains **14 FPS**.
|
| 38 |
|
| 39 |
### Qualitative comparison
|
| 40 |
|
| 41 |
+
<img src="assets/qualitative.png" width="100%" alt="SwiftVR qualitative comparison">
|
|
|
|
| 42 |
|
|
|
|
| 43 |
## π Installation
|
| 44 |
+
|
| 45 |
```bash
|
| 46 |
+
git clone https://github.com/H-oliday/SwiftVR.git
|
| 47 |
+
cd SwiftVR
|
| 48 |
|
| 49 |
+
conda create -n swiftvr python=3.10 -y
|
| 50 |
+
conda activate swiftvr
|
| 51 |
|
| 52 |
# Install PyTorch matching your CUDA toolkit first, e.g. CUDA 12.4:
|
| 53 |
pip install torch==2.10.0 torchvision==0.25.0 --index-url https://download.pytorch.org/whl/cu124
|
| 54 |
|
| 55 |
+
# Install SwiftVR (editable) and its dependencies:
|
| 56 |
pip install -e .
|
| 57 |
```
|
| 58 |
|
| 59 |
<details>
|
| 60 |
<summary><b>Hardware notes</b></summary>
|
| 61 |
|
| 62 |
+
* **Server:** single H100-80G reproduces the QHD/4K numbers above.
|
| 63 |
+
* **Consumer:** single RTX 5090 reaches β26 FPS at 1080p with the *same checkpoint* (default PyTorch SDPA path, bfloat16, causal chunk protocol).
|
| 64 |
+
* No hardware-specific retraining or kernel rewrite is required on any platform.
|
|
|
|
| 65 |
|
| 66 |
+
</details>
|
| 67 |
|
|
|
|
| 68 |
## π Model Zoo
|
| 69 |
+
|
| 70 |
+
| Model Name | Date | Backbone | Link |
|
| 71 |
+
| ---------- | ------- | -------------- | ----------------------------------------------------- |
|
| 72 |
+
| SwiftVR | 2026.06 | Wan2.2-TI2V-5B | [π€ HuggingFace](https://huggingface.co/H-oliday/SwiftVR) |
|
| 73 |
|
| 74 |
```bash
|
| 75 |
+
huggingface-cli download H-oliday/SwiftVR --local-dir checkpoints/
|
| 76 |
```
|
| 77 |
|
| 78 |
+
Expected checkpoint layout, where `checkpoints/` is the directory passed to `from_pretrained`:
|
| 79 |
|
| 80 |
+
```text
|
| 81 |
checkpoints/
|
| 82 |
+
βββ reae.safetensors # Restoration-aware Autoencoder weights
|
| 83 |
+
βββ prompt_embedding.safetensors # precomputed empty-prompt text embedding, key: "prompt_emb"
|
| 84 |
+
βββ transformer/ # diffusers-format DiT
|
| 85 |
βββ config.json
|
| 86 |
βββ diffusion_pytorch_model.safetensors
|
| 87 |
```
|
| 88 |
|
|
|
|
| 89 |
## π Quick Start
|
| 90 |
+
|
| 91 |
### Python API
|
| 92 |
|
| 93 |
```python
|
| 94 |
+
from swiftvr import SwiftVRPipeline
|
| 95 |
|
| 96 |
+
pipe = SwiftVRPipeline.from_pretrained("checkpoints/").to("cuda", dtype="bfloat16")
|
| 97 |
|
| 98 |
pipe.restore_video("low_quality.mp4", "restored.mp4", upscale=4)
|
| 99 |
```
|
| 100 |
|
| 101 |
+
`restore_video` also accepts an image folder as input and can write a PNG sequence with `png_save=True`.
|
| 102 |
+
|
| 103 |
+
Tunable knobs include:
|
| 104 |
+
|
| 105 |
+
* `clip_len`: middle chunk size, multiple of 4
|
| 106 |
+
* `dit_overlap`: overlap for DiT inference
|
| 107 |
+
* `fps`: output video frame rate
|
| 108 |
+
* `quality`: 0β100, mapped to x265 CRF
|
| 109 |
+
* `queue_size`: pipeline queue size
|
| 110 |
|
| 111 |
+
### Streaming
|
| 112 |
+
|
| 113 |
+
Causal, chunk-by-chunk restoration without future frames.
|
| 114 |
|
| 115 |
```python
|
| 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) # [1, T', 3, H', W'] in [0, 1], or None if buffered
|
| 120 |
if hq is not None:
|
| 121 |
write(hq)
|
| 122 |
|
| 123 |
+
tail = session.flush() # flush the final buffered frames
|
| 124 |
```
|
| 125 |
|
| 126 |
### Command line
|
|
|
|
| 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 |
## π Repository Structure
|
| 141 |
+
|
| 142 |
+
```text
|
| 143 |
+
SwiftVR/
|
| 144 |
βββ README.md
|
| 145 |
+
βββ LICENSE
|
| 146 |
βββ requirements.txt
|
| 147 |
βββ setup.py
|
| 148 |
βββ scripts/
|
| 149 |
+
β βββ inference.py # CLI entry point, thin wrapper over SwiftVRPipeline
|
| 150 |
+
βββ swiftvr/
|
| 151 |
+
βββ __init__.py # exports SwiftVRPipeline
|
| 152 |
+
βββ pipeline.py # SwiftVRPipeline: from_pretrained / to / restore_video / stream
|
| 153 |
+
βββ runner.py # four-stage pipelined runner: reader β H2D β GPU β writer
|
| 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 |
|
| 172 |
+
SwiftVR is released under the **Apache License 2.0**.
|
| 173 |
|
| 174 |
+
Copyright 2026 SwiftVR Authors.
|
| 175 |
|
| 176 |
+
Licensed under the Apache License, Version 2.0. You may obtain a copy of the License at:
|
| 177 |
|
| 178 |
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
| 179 |
|
| 180 |
+
Unless required by applicable law or agreed to in writing, this project is distributed on an **"AS IS" BASIS**, without warranties or conditions of any kind, either express or implied. See the [LICENSE](./LICENSE) file for the full license text.
|
| 181 |
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
|
| 184 |
+
## Contact
|
| 185 |
+
|
| 186 |
+
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>
|
assets/qualitative.png
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/teaser.avif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|