SeedVR2 ONNX

ONNX builds of SeedVR2, made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each precision is one folder holding the graphs and a small Python pipeline.py that does the rest (image preprocessing, the frame loop, mask handling); what the graphs take and return is under How to run.

Files

The last column is the benchmark against the original PyTorch model (details under How to run): how closely each output frame matches the original's on the same clips and masks.

Precision File Size sha256 Benchmark
fp16 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)
fp16 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)
fp16 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)
fp16 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)
fp16 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)
fp16 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)
fp16 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)
fp16 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)
int8 int8/LICENSE.txt 11.5 kB fa62fea050d2 DiT MatMuls 8-bit: PSNR mean 40.4 / 33.2 dB, worst frame 40.1 / 32.8 dB; ~24 s per clip (CUDA)
int8 int8/dit.onnx 1.6 MB e73874804e60 DiT MatMuls 8-bit: PSNR mean 40.4 / 33.2 dB, worst frame 40.1 / 32.8 dB; ~24 s per clip (CUDA)
int8 int8/dit.onnx.data 3.56 GB c36caaa97940 DiT MatMuls 8-bit: PSNR mean 40.4 / 33.2 dB, worst frame 40.1 / 32.8 dB; ~24 s per clip (CUDA)
int8 int8/pipeline.py 12.6 kB 41341ecf6d57 DiT MatMuls 8-bit: PSNR mean 40.4 / 33.2 dB, worst frame 40.1 / 32.8 dB; ~24 s per clip (CUDA)
int8 int8/vae_dec_first.onnx 301.7 MB 8250314ef04d DiT MatMuls 8-bit: PSNR mean 40.4 / 33.2 dB, worst frame 40.1 / 32.8 dB; ~24 s per clip (CUDA)
int8 int8/vae_dec_next.onnx 301.5 MB e300dd92f6f7 DiT MatMuls 8-bit: PSNR mean 40.4 / 33.2 dB, worst frame 40.1 / 32.8 dB; ~24 s per clip (CUDA)
int8 int8/vae_enc_first.onnx 200.5 MB d6a9041ed8a4 DiT MatMuls 8-bit: PSNR mean 40.4 / 33.2 dB, worst frame 40.1 / 32.8 dB; ~24 s per clip (CUDA)
int8 int8/vae_enc_next.onnx 200.3 MB bcffa79fd16d DiT MatMuls 8-bit: PSNR mean 40.4 / 33.2 dB, worst frame 40.1 / 32.8 dB; ~24 s per clip (CUDA)

How to run

SeedVR2-3B (ByteDance Seed: one-step diffusion video restoration and super-resolution) as five ONNX graphs plus pipeline.py, a numpy runtime that reproduces the repository's projects/inference_seedvr2_3b.py: one diffusion step at t = 1000, guidance 1, the repository's positive text embedding (baked into the DiT graph). Like the script, it has no colour fix: the script's color_fix.py isn't in the repository.

How it runs. Resize the low-quality frames to the output size first, as the script does. Then:

  • Encode: the VAE encoder encodes the frames in causal slices (5 frames, then 4 per slice).
  • Restore: the NaDiT (a 3B diffusion transformer with windowed attention, two window layouts alternating) predicts the clean latent from noise in one step, conditioned on the encoded frames.
  • Decode: the VAE decoder decodes in causal slices (2 latents, then 1 per slice).

The graphs.

  • vae_enc_first.onnx / vae_enc_next.onnx:
    • inputs: x [1, 3, n, H, W] in [-1, 1], plus the causal convolutions' memories;
    • outputs: moments [1, 32, t, H/8, W/8] (mean, log-variance), plus the new memories.
  • dit.onnx:
    • inputs: vid [T, h, w, 33] (noise, latent, 1), and for each window layout the token indices, key mask, inverse indices and RoPE tables (pipeline.py builds them as the repository's make_720Pwindows_bysize does);
    • output: v [T, h, w, 16].
  • vae_dec_first.onnx / vae_dec_next.onnx: latents in, frames [1, 3, n, H, W] out (with the memories).
import sys
from PIL import Image
sys.path.insert(0, "fp16")
import pipeline
p = pipeline.SeedVR2("fp16", "cuda")
frames = [Image.open(f"in/{i:05d}.png").convert("RGB") for i in range(17)]   # already at the output size
out = p(frames, seed=666)                                                     # list of uint8 RGB frames

Or python fp16/pipeline.py frames_dir out_dir --cuda. Frame sides must be multiples of 16. It needs numpy, onnxruntime-gpu and Pillow.

Ported as the original behaves.

  • Steps: the script's padding to 4n + 1 frames, the VAE's scaling factor 0.9152, and the condition latent concatenated with a ones channel.
  • Noise: pipeline.py draws its own noise with numpy (seed 666 by default), so its output differs slightly from the original's. draws= replays your own draws.

Memory and processes. Windows counts GPU allocations toward the commit limit, so pipeline.py runs the encode, the DiT and the decode each in its own process (separate_processes=True).

  • DiT session: needs about 7 GB with fp16/ at these sizes.
  • Decoder: its sessions let cuDNN search its algorithms exhaustively, because the heuristic choices for some frame sizes need far more memory. Even so, decoding 17 frames at 384 x 384 peaks near 15 GB of commit on this machine (RTX 3080 Laptop, 16 GB). The runs sometimes had to be repeated to fit.
  • Bigger clips: cut them into shorter clips, or use a machine with more memory.

Precisions.

  • fp16/: the DiT fp16 (the original runs bf16; here its bf16 weights are cast to fp16); the VAE graphs do fp16 math with fp32 inputs and outputs.
  • int8/: the DiT's MatMuls 8-bit MatMulNBits (block 32); the VAE as fp16/.
  • No int4: tried (the DiT 4-bit) and below the pass mark, 24.8 dB on example1.

Benchmark.

  • Clips: two of 17 frames from FlashVSR's example clips, the low-res frames resized (bicubic) to the output size: example0 384 x 384, example1 512 x 288.
  • Original: projects/inference_seedvr2_3b.py (GitHub ByteDance-Seed/SeedVR @ e4de8c2) on CUDA under bf16 autocast as it runs, seed 666, with every random draw recorded. The builds replay those draws (draws=).
    • The DiT was loaded from bf16 copies of its weights: the script's fp32 weights don't fit in memory here.
    • Its fused kernels don't build on Windows (apex's fused norms, flash-attn's varlen attention), so the reference used the same operations in plain PyTorch.
  • Score: PSNR of every output frame against the original's.
  • Pass mark: at least 30 dB on every frame.
PSNR mean (example0 / example1) worst frame seconds per clip
original (PyTorch bf16, CUDA) - - 6.1 / 5.4
fp16/ 40.8 / 33.3 dB 40.5 / 32.9 dB 25
int8/ 40.4 / 33.2 dB 40.1 / 32.8 dB 23-25
int4 (not published) - / 24.8 dB - / 24.4 dB 23

The ONNX times include starting the three phase processes and loading their sessions.

License. SeedVR2 is Apache-2.0 (LICENSE.txt in every folder).

How these were made

From SeedVR2 at revision 37255ff8cc. The graphs were exported from the original PyTorch modules with torch.onnx (opset 17 / 18) and checked against them. Weight-only quantization: int8 is a per-output-channel int8 weight behind DequantizeLinear, int4 is ONNX Runtime's MatMulNBits (block 32). Each card above says which precision every graph uses. Every precision was benchmarked against the original before upload (the pass mark is under How to run), and the sha256 column above is what the files must hash to.

License

Apache-2.0. These files are a derivative of the original model and carry its license: it is copied in this repository, and it governs your use of these files. The original model card follows unchanged.


Original model card

SeedVR

SeedVR2: One-Step Video Restoration via Diffusion Adversarial Post-Training

Jianyi Wang, Shanchuan Lin, Zhijie Lin, Yuxi Ren, Meng Wei, Zongsheng Yue, Shangchen Zhou, Hao Chen, Yang Zhao, Ceyuan Yang, Xuefeng Xiao, Chen Change Loy, Lu Jiang

SeedVR Website SeedVR2 Paper on ArXiv Github SeedVR Models SeedVR2 Space SeedVR2 Video Demo on YouTube

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.

๐Ÿ“ฎ Notice

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.

โœ๏ธ Citation

@article{wang2025seedvr2,
      title={SeedVR2: One-Step Video Restoration via Diffusion Adversarial Post-Training},
      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},
      booktitle={arXiv preprint arXiv:2506.05301},
      year={2025}
   }

@inproceedings{wang2025seedvr,
      title={SeedVR: Seeding Infinity in Diffusion Transformer Towards Generic Video Restoration},
      author={Wang, Jianyi and Lin, Zhijie and Wei, Meng and Zhao, Yang and Yang, Ceyuan and Loy, Chen Change and Jiang, Lu},
      booktitle={CVPR},
      year={2025}
   }

๐Ÿ“œ License

SeedVR and SeedVR2 are licensed under the Apache 2.0.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for moonbox-dev/SeedVR2-3B-ONNX

Quantized
(9)
this model

Paper for moonbox-dev/SeedVR2-3B-ONNX