jennyxue commited on
Commit
c3df9f3
·
verified ·
1 Parent(s): 0c45275

Model card and the original license

Browse files
Files changed (4) hide show
  1. .gitattributes +2 -0
  2. README.md +210 -0
  3. assets/seedvr_logo.png +3 -0
  4. assets/teaser.png +3 -0
.gitattributes CHANGED
@@ -34,3 +34,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  fp16/dit.onnx.data filter=lfs diff=lfs merge=lfs -text
 
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  fp16/dit.onnx.data filter=lfs diff=lfs merge=lfs -text
37
+ assets/seedvr_logo.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/teaser.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: ByteDance-Seed/SeedVR2-3B
3
+ base_model_relation: quantized
4
+ license: apache-2.0
5
+ pipeline_tag: image-to-video
6
+ library_name: onnx
7
+ tags:
8
+ - onnx
9
+ - moonbox
10
+ - onnxruntime
11
+ - seedvr2
12
+ - video-super-resolution
13
+ - video-restoration
14
+ ---
15
+
16
+ # SeedVR2 ONNX
17
+
18
+ ONNX builds of [SeedVR2](https://huggingface.co/ByteDance-Seed/SeedVR2-3B), made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each
19
+ precision is one folder holding the graphs and a small Python `pipeline.py` that does the rest (image preprocessing,
20
+ the frame loop, mask handling); what the graphs take and return is under *How to run*.
21
+
22
+ ## Files
23
+
24
+ The last column is the benchmark against the original PyTorch model (details under *How to run*): how closely each
25
+ output frame matches the original's on the same clips and masks.
26
+
27
+ | Precision | File | Size | sha256 | Benchmark |
28
+ |---|---|---|---|---|
29
+ | fp16 | [`fp16/LICENSE.txt`](https://huggingface.co/moonbox-dev/SeedVR2-3B-ONNX/blob/main/fp16/LICENSE.txt) | 11.5 kB | `fa62fea050d2` | PSNR vs the original: mean 40.8 / 33.3 dB, worst frame 40.5 / 32.9 dB; ~25 s per clip incl. process / session start (CUDA; original 6 s) |
30
+ | fp16 | [`fp16/dit.onnx`](https://huggingface.co/moonbox-dev/SeedVR2-3B-ONNX/blob/main/fp16/dit.onnx) | 1.6 MB | `2abfbfe54b7a` | PSNR vs the original: mean 40.8 / 33.3 dB, worst frame 40.5 / 32.9 dB; ~25 s per clip incl. process / session start (CUDA; original 6 s) |
31
+ | fp16 | [`fp16/dit.onnx.data`](https://huggingface.co/moonbox-dev/SeedVR2-3B-ONNX/blob/main/fp16/dit.onnx.data) | 6.69 GB | `bd4afa1dd50e` | PSNR vs the original: mean 40.8 / 33.3 dB, worst frame 40.5 / 32.9 dB; ~25 s per clip incl. process / session start (CUDA; original 6 s) |
32
+ | fp16 | [`fp16/pipeline.py`](https://huggingface.co/moonbox-dev/SeedVR2-3B-ONNX/blob/main/fp16/pipeline.py) | 12.6 kB | `41341ecf6d57` | PSNR vs the original: mean 40.8 / 33.3 dB, worst frame 40.5 / 32.9 dB; ~25 s per clip incl. process / session start (CUDA; original 6 s) |
33
+ | fp16 | [`fp16/vae_dec_first.onnx`](https://huggingface.co/moonbox-dev/SeedVR2-3B-ONNX/blob/main/fp16/vae_dec_first.onnx) | 301.7 MB | `8250314ef04d` | PSNR vs the original: mean 40.8 / 33.3 dB, worst frame 40.5 / 32.9 dB; ~25 s per clip incl. process / session start (CUDA; original 6 s) |
34
+ | fp16 | [`fp16/vae_dec_next.onnx`](https://huggingface.co/moonbox-dev/SeedVR2-3B-ONNX/blob/main/fp16/vae_dec_next.onnx) | 301.5 MB | `e300dd92f6f7` | PSNR vs the original: mean 40.8 / 33.3 dB, worst frame 40.5 / 32.9 dB; ~25 s per clip incl. process / session start (CUDA; original 6 s) |
35
+ | fp16 | [`fp16/vae_enc_first.onnx`](https://huggingface.co/moonbox-dev/SeedVR2-3B-ONNX/blob/main/fp16/vae_enc_first.onnx) | 200.5 MB | `d6a9041ed8a4` | PSNR vs the original: mean 40.8 / 33.3 dB, worst frame 40.5 / 32.9 dB; ~25 s per clip incl. process / session start (CUDA; original 6 s) |
36
+ | fp16 | [`fp16/vae_enc_next.onnx`](https://huggingface.co/moonbox-dev/SeedVR2-3B-ONNX/blob/main/fp16/vae_enc_next.onnx) | 200.3 MB | `bcffa79fd16d` | PSNR vs the original: mean 40.8 / 33.3 dB, worst frame 40.5 / 32.9 dB; ~25 s per clip incl. process / session start (CUDA; original 6 s) |
37
+
38
+ ## How to run
39
+
40
+ SeedVR2-3B (ByteDance Seed: one-step diffusion video restoration and super-resolution) as five ONNX graphs plus
41
+ `pipeline.py`, a numpy runtime that reproduces the repository's `projects/inference_seedvr2_3b.py`: one diffusion
42
+ step at t = 1000, guidance 1, the repository's positive text embedding (baked into the DiT graph). Like the script, it
43
+ has no colour fix: the script's `color_fix.py` isn't in the repository.
44
+
45
+ **How it runs.** Resize the low-quality frames to the output size first, as the script does. Then:
46
+ - **Encode:** the VAE encoder encodes the frames in causal slices (5 frames, then 4 per slice).
47
+ - **Restore:** the NaDiT (a 3B diffusion transformer with windowed attention, two window layouts alternating) predicts
48
+ the clean latent from noise in one step, conditioned on the encoded frames.
49
+ - **Decode:** the VAE decoder decodes in causal slices (2 latents, then 1 per slice).
50
+
51
+ **The graphs.**
52
+ - `vae_enc_first.onnx` / `vae_enc_next.onnx`:
53
+ - inputs: `x` [1, 3, n, H, W] in [-1, 1], plus the causal convolutions' memories;
54
+ - outputs: moments [1, 32, t, H/8, W/8] (mean, log-variance), plus the new memories.
55
+ - `dit.onnx`:
56
+ - inputs: `vid` [T, h, w, 33] (noise, latent, 1), and for each window layout the token indices, key mask, inverse
57
+ indices and RoPE tables (`pipeline.py` builds them as the repository's `make_720Pwindows_bysize` does);
58
+ - output: `v` [T, h, w, 16].
59
+ - `vae_dec_first.onnx` / `vae_dec_next.onnx`: latents in, frames [1, 3, n, H, W] out (with the memories).
60
+
61
+ ```python
62
+ import sys
63
+ from PIL import Image
64
+ sys.path.insert(0, "fp16")
65
+ import pipeline
66
+ p = pipeline.SeedVR2("fp16", "cuda")
67
+ frames = [Image.open(f"in/{i:05d}.png").convert("RGB") for i in range(17)] # already at the output size
68
+ out = p(frames, seed=666) # list of uint8 RGB frames
69
+ ```
70
+
71
+ Or `python fp16/pipeline.py frames_dir out_dir --cuda`. Frame sides must be multiples of 16. It needs numpy,
72
+ onnxruntime-gpu and Pillow.
73
+
74
+ **Ported as the original behaves.**
75
+ - **Steps:** the script's padding to 4n + 1 frames, the VAE's scaling factor 0.9152, and the condition latent
76
+ concatenated with a ones channel.
77
+ - **Noise:** `pipeline.py` draws its own noise with numpy (seed 666 by default), so its output differs slightly from
78
+ the original's. `draws=` replays your own draws.
79
+
80
+ **Memory and processes.** Windows counts GPU allocations toward the commit limit, so `pipeline.py` runs the encode,
81
+ the DiT and the decode each in its own process (`separate_processes=True`).
82
+ - **DiT session:** needs about 7 GB with `fp16/` at these sizes.
83
+ - **Decoder:** its sessions let cuDNN search its algorithms exhaustively, because the heuristic choices for some frame
84
+ sizes need far more memory. Even so, decoding 17 frames at 384 x 384 peaks near 15 GB of commit on this machine
85
+ (RTX 3080 Laptop, 16 GB). The runs sometimes had to be repeated to fit.
86
+ - **Bigger clips:** cut them into shorter clips, or use a machine with more memory.
87
+
88
+ **Precisions.**
89
+ - `fp16/`: the DiT fp16 (the original runs bf16; here its bf16 weights are cast to fp16); the VAE graphs do fp16 math
90
+ with fp32 inputs and outputs.
91
+ - `int8/`: the DiT's MatMuls 8-bit MatMulNBits (block 32); the VAE as `fp16/`.
92
+ - No int4: tried (the DiT 4-bit) and below the pass mark, 24.8 dB on example1.
93
+
94
+ **Benchmark.**
95
+ - **Clips:** two of 17 frames from FlashVSR's example clips, the low-res frames resized (bicubic) to the output size:
96
+ example0 384 x 384, example1 512 x 288.
97
+ - **Original:** `projects/inference_seedvr2_3b.py` (GitHub ByteDance-Seed/SeedVR @ e4de8c2) on CUDA under bf16
98
+ autocast as it runs, seed 666, with every random draw recorded. The builds replay those draws (`draws=`).
99
+ - The DiT was loaded from bf16 copies of its weights: the script's fp32 weights don't fit in memory here.
100
+ - Its fused kernels don't build on Windows (apex's fused norms, flash-attn's varlen attention), so the reference
101
+ used the same operations in plain PyTorch.
102
+ - **Score:** PSNR of every output frame against the original's.
103
+ - **Pass mark:** at least 30 dB on every frame.
104
+
105
+ | | PSNR mean (example0 / example1) | worst frame | seconds per clip |
106
+ |---|---|---|---|
107
+ | original (PyTorch bf16, CUDA) | - | - | 6.1 / 5.4 |
108
+ | `fp16/` | 40.8 / 33.3 dB | 40.5 / 32.9 dB | 25 |
109
+ | `int8/` | 40.4 / 33.2 dB | 40.1 / 32.8 dB | 23-25 |
110
+ | int4 (not published) | - / 24.8 dB | - / 24.4 dB | 23 |
111
+
112
+ The ONNX times include starting the three phase processes and loading their sessions.
113
+
114
+ **License.** SeedVR2 is Apache-2.0 (`LICENSE.txt` in every folder).
115
+
116
+ ## How these were made
117
+
118
+ From [SeedVR2](https://huggingface.co/ByteDance-Seed/SeedVR2-3B) at revision `37255ff8cc`. The graphs were exported from the original PyTorch modules with
119
+ torch.onnx (opset 17 / 18) and checked against them. Weight-only quantization: int8 is a per-output-channel int8
120
+ weight behind DequantizeLinear, int4 is ONNX Runtime's MatMulNBits (block 32). Each card above says which precision
121
+ every graph uses. Every precision was benchmarked against the original before upload (the pass mark is under *How to run*), and the
122
+ `sha256` column above is what the files must hash to.
123
+
124
+ ## License
125
+
126
+ Apache-2.0. These files are a derivative of the original model and carry its license: it is copied in this
127
+ repository, and it governs your use of these files. The original model card follows unchanged.
128
+
129
+ ---
130
+
131
+ # Original model card
132
+
133
+ <div align="center">
134
+ <img src="assets/seedvr_logo.png" alt="SeedVR" width="400"/>
135
+ </div>
136
+
137
+
138
+ # SeedVR2: One-Step Video Restoration via Diffusion Adversarial Post-Training
139
+ > [Jianyi Wang](https://iceclear.github.io), [Shanchuan Lin](https://scholar.google.com/citations?user=EDWUw7gAAAAJ&hl=en), [Zhijie Lin](https://scholar.google.com/citations?user=xXMj6_EAAAAJ&hl=en), [Yuxi Ren](https://scholar.google.com.hk/citations?user=C_6JH-IAAAAJ&hl=en), [Meng Wei](https://openreview.net/profile?id=~Meng_Wei11), [Zongsheng Yue](https://zsyoaoa.github.io/), [Shangchen Zhou](https://shangchenzhou.com/), [Hao Chen](https://haochen-rye.github.io/), [Yang Zhao](https://scholar.google.com/citations?user=uPmTOHAAAAAJ&hl=en), [Ceyuan Yang](https://ceyuan.me/), [Xuefeng Xiao](https://scholar.google.com/citations?user=CVkM9TQAAAAJ&hl=en), [Chen Change Loy](https://www.mmlab-ntu.com/person/ccloy/index.html), [Lu Jiang](http://www.lujiang.info/)
140
+
141
+ <p align="center">
142
+ <a href="https://iceclear.github.io/projects/seedvr2/">
143
+ <img
144
+ src="https://img.shields.io/badge/SeedVR2-Website-0A66C2?logo=safari&logoColor=white"
145
+ alt="SeedVR Website"
146
+ />
147
+ </a>
148
+ <a href="http://arxiv.org/abs/2506.05301">
149
+ <img
150
+ src="https://img.shields.io/badge/SeedVR2-Paper-red?logo=arxiv&logoColor=red"
151
+ alt="SeedVR2 Paper on ArXiv"
152
+ />
153
+ </a>
154
+ <a href="https://github.com/ByteDance-Seed/SeedVR">
155
+ <img
156
+ alt="Github" src="https://img.shields.io/badge/SeedVR2-Codebase-536af5?color=536af5&logo=github"
157
+ alt="SeedVR2 Codebase"
158
+ />
159
+ </a>
160
+ <a href="https://huggingface.co/collections/ByteDance-Seed/seedvr-6849deeb461c4e425f3e6f9e">
161
+ <img
162
+ src="https://img.shields.io/badge/SeedVR-Models-yellow?logo=huggingface&logoColor=yellow"
163
+ alt="SeedVR Models"
164
+ />
165
+ </a>
166
+ <a href="https://huggingface.co/spaces/ByteDance-Seed/SeedVR2-3B">
167
+ <img
168
+ src="https://img.shields.io/badge/SeedVR2-Space-orange?logo=huggingface&logoColor=yellow"
169
+ alt="SeedVR2 Space"
170
+ />
171
+ </a>
172
+ <a href="https://www.youtube.com/watch?v=tM8J-WhuAH0" target='_blank'>
173
+ <img
174
+ src="https://img.shields.io/badge/Demo%20Video-%23FF0000.svg?logo=YouTube&logoColor=white"
175
+ alt="SeedVR2 Video Demo on YouTube"
176
+ />
177
+ </a>
178
+ </p>
179
+
180
+ >
181
+ > Recent advances in diffusion-based video restoration (VR) demonstrate significant improvement in visual quality, yet yield a prohibitive computational cost during inference. While several distillation-based approaches have exhibited the potential of one-step image restoration, extending existing approaches to VR remains challenging and underexplored, due to the limited generation ability and poor temporal consistency, particularly when dealing with high-resolution video in real-world settings. In this work, we propose a one-step diffusion-based VR model, termed as SeedVR2, which performs adversarial VR training against real data. To handle the challenging high-resolution VR within a single step, we introduce several enhancements to both model architecture and training procedures. Specifically, an adaptive window attention mechanism is proposed, where the window size is dynamically adjusted to fit the output resolutions, avoiding window inconsistency observed under high-resolution VR using window attention with a predefined window size. To stabilize and improve the adversarial post-training towards VR, we further verify the effectiveness of a series of losses, including a proposed feature matching loss without significantly sacrificing training efficiency. Extensive experiments show that SeedVR2 can achieve comparable or even better performance compared with existing VR approaches in a single step.
182
+
183
+ <p align="center"><img src="assets/teaser.png" width="100%"></p>
184
+
185
+
186
+ ## 📮 Notice
187
+ **Limitations:** These are the prototype models and the performance may not be perfectly align with the paper. Our methods are sometimes not robust to heavy degradations and very large motions, and shares some failure cases with existing methods, e.g., fail to fully remove the degradation or simply generate unpleasing details. Moreover, due to the strong generation ability, Our methods tend to overly generate details on inputs with very light degradations, e.g., 720p AIGC videos, leading to oversharpened results occasionally.
188
+
189
+
190
+ ## ✍️ Citation
191
+
192
+ ```bibtex
193
+ @article{wang2025seedvr2,
194
+ title={SeedVR2: One-Step Video Restoration via Diffusion Adversarial Post-Training},
195
+ author={Wang, Jianyi and Lin, Shanchuan and Lin, Zhijie and Ren, Yuxi and Wei, Meng and Yue, Zongsheng and Zhou, Shangchen and Chen, Hao and Zhao, Yang and Yang, Ceyuan and Xiao, Xuefeng and Loy, Chen Change and Jiang, Lu},
196
+ booktitle={arXiv preprint arXiv:2506.05301},
197
+ year={2025}
198
+ }
199
+
200
+ @inproceedings{wang2025seedvr,
201
+ title={SeedVR: Seeding Infinity in Diffusion Transformer Towards Generic Video Restoration},
202
+ author={Wang, Jianyi and Lin, Zhijie and Wei, Meng and Zhao, Yang and Yang, Ceyuan and Loy, Chen Change and Jiang, Lu},
203
+ booktitle={CVPR},
204
+ year={2025}
205
+ }
206
+ ```
207
+
208
+
209
+ ## 📜 License
210
+ SeedVR and SeedVR2 are licensed under the Apache 2.0.
assets/seedvr_logo.png ADDED

Git LFS Details

  • SHA256: 9a08170e6ce79f87ad524d4ad5c083c8f1766f245d9dfea6b54fde5dca00f4a2
  • Pointer size: 131 Bytes
  • Size of remote file: 168 kB
assets/teaser.png ADDED

Git LFS Details

  • SHA256: 1aa53097c719d208642536f4684a174a260ab63ed4dda6515d83a2cb6b4f76ff
  • Pointer size: 132 Bytes
  • Size of remote file: 1.34 MB