Video-to-Video
Diffusers
Safetensors
H-oliday commited on
Commit
40de76f
Β·
verified Β·
1 Parent(s): c0fe318

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +90 -89
  2. assets/qualitative.png +2 -2
  3. assets/teaser.avif +2 -2
README.md CHANGED
@@ -1,130 +1,126 @@
1
- ---
2
- license: apache-2.0
3
 
4
- ---
5
 
6
- <h1 align="center">RVR: One-step Generative Streaming Real-time Video Restoration</h1>
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/RVR/"><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/RVR"><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/RVR/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
- - [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
- | Metric | SeedVR2-3B (tile)| DOVE (tile)| FlashVSR-Tiny | **RVR (Ours)** |
 
 
 
 
43
  |---|:---:|:---:|:---:|:---:|
44
- | Avg. Time (s) ↓ | 17.320 | 27.615 | 2.493 | 0.766 |
45
- | FPS ↑ | 1.39 | 0.85 | 9.61 | 31.32 |
46
- | Peak Mem. (GB) ↓ | 35.35 | 59.24 | 34.35 | 38.01 |
47
 
48
- > At **3840Γ—2160**, every compared diffusion-based VR baseline **OOMs** on a single H100; RVR sustains **14 FPS**.
49
 
50
  ### Qualitative comparison
51
 
52
- <img src="assets/qualitative.png" width="100%" alt="RVR teaser">
53
-
54
 
55
- ---
56
  ## πŸ›  Installation
 
57
  ```bash
58
- git clone https://github.com/Holiday/RVR.git
59
- cd RVR
60
 
61
- conda create -n rvr python=3.10 -y
62
- conda activate rvr
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 RVR (editable) and its dependencies:
68
  pip install -e .
69
  ```
70
 
71
  <details>
72
  <summary><b>Hardware notes</b></summary>
73
 
74
- - **Server:** single H100-80G reproduces the QHD/4K numbers above.
75
- - **Consumer:** single RTX 5090 reaches β‰ˆ26 FPS at 1080p with the *same checkpoint* (default PyTorch SDPA path, bfloat16, causal chunk protocol).
76
- - No hardware-specific retraining or kernel rewrite is required on any platform.
77
- </details>
78
 
 
79
 
80
- ---
81
  ## πŸ—‚ Model Zoo
82
- | Model Name | Date | Backbone | Link |
83
- |---|---|---|---|
84
- | RVR | 2026.06 | Wan2.2-TI2V-5B | [πŸ€— HuggingFace](https://huggingface.co/H-oliday/RVR) |
 
85
 
86
  ```bash
87
- huggingface-cli download H-oliday/RVR --local-dir checkpoints/
88
  ```
89
 
90
- Expected checkpoint layout (the directory passed to `from_pretrained`):
91
 
92
- ```
93
  checkpoints/
94
- β”œβ”€β”€ reae.safetensors # Restoration-aware Autoencoder weights
95
- β”œβ”€β”€ prompt_embedding.safetensors# precomputed empty-prompt text embedding (key: "prompt_emb")
96
- └── transformer/ # diffusers-format DiT
97
  β”œβ”€β”€ config.json
98
  └── diffusion_pytorch_model.safetensors
99
  ```
100
 
101
- ---
102
  ## πŸš€ Quick Start
 
103
  ### Python API
104
 
105
  ```python
106
- from rvr import RVRPipeline
107
 
108
- pipe = RVRPipeline.from_pretrained("checkpoints/").to("cuda", dtype="bfloat16")
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
- (`png_save=True`). Tunable knobs: `clip_len` (MIDDLE chunk size, multiple of 4),
115
- `dit_overlap`, `fps`, `quality` (0–100, mapped to x265 CRF), `queue_size`.
 
 
 
 
 
 
116
 
117
- ### Streaming (causal, chunk by chunk, no future frames)
 
 
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) # [1, T', 3, H', W'] in [0, 1], or None if buffered
124
  if hq is not None:
125
  write(hq)
126
 
127
- tail = session.flush() # flush the final buffered frames
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
- RVR/
 
150
  β”œβ”€β”€ README.md
 
151
  β”œβ”€β”€ requirements.txt
152
  β”œβ”€β”€ setup.py
153
  β”œβ”€β”€ scripts/
154
- β”‚ └── inference.py # CLI entry point (thin wrapper over RVRPipeline)
155
- └── rvr/
156
- β”œβ”€β”€ __init__.py # exports RVRPipeline
157
- β”œβ”€β”€ pipeline.py # RVRPipeline: from_pretrained / to / restore_video / stream
158
- β”œβ”€β”€ runner.py # four-stage pipelined runner (reader β†’ H2D β†’ GPU β†’ writer)
159
  β”œβ”€β”€ io.py # frame reading, GPU preprocessing, mp4 / PNG writing
160
  β”œβ”€β”€ models/
161
- β”‚ β”œβ”€β”€ reae.py # β˜… Restoration-aware Autoencoder
162
- β”‚ └── transformer.py # β˜… DiT + mask-free shifted-window self-attention
163
  └── streaming/
164
  β”œβ”€β”€ chunk.py # fixed-size causal chunk protocol
165
- β”œβ”€β”€ tae.py # streaming autoencoder (causal boundary state)
166
- └── dit.py # one-step streaming DiT (fixed timestep, RoPE offsets)
167
  ```
168
 
 
169
 
170
- ---
171
- ## 🎬 More Visual Results
172
- > Full-length restored clips (low-quality input β†’ RVR, played back to back).
173
 
 
174
 
175
- <video src="https://huggingface.co/H-oliday/RVR/resolve/main/assets/demo_1.mp4" controls width="100%"></video>
176
 
177
- <video src="https://huggingface.co/H-oliday/RVR/resolve/main/assets/demo_2.mp4" controls width="100%"></video>
178
 
179
- <video src="https://huggingface.co/H-oliday/RVR/resolve/main/assets/demo_3.mp4" controls width="100%"></video>
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

  • SHA256: a37c552e1b39db6586f17ce4b9715dbe751dab18684deea621a2fa02a614355a
  • Pointer size: 132 Bytes
  • Size of remote file: 8.01 MB

Git LFS Details

  • SHA256: 856b436451495a4c5b8aad4953ad9f859d7388e1ccc498c717f4c9dff2b949de
  • Pointer size: 132 Bytes
  • Size of remote file: 2.84 MB
assets/teaser.avif CHANGED

Git LFS Details

  • SHA256: f777ab945ace4a906f27ffcad34f63fe866b6e79653b0863837a02c9ad66d306
  • Pointer size: 132 Bytes
  • Size of remote file: 1.21 MB

Git LFS Details

  • SHA256: cdbe7f2bfb72b0a9884826b761fa80e165c7c6e877be1a179e89b83bab5e1628
  • Pointer size: 132 Bytes
  • Size of remote file: 1.21 MB