SeedVR2-3B for Core ML (one 512 px frame, int4 DiT)

A Core ML conversion of SeedVR2-3B (SeedVR2: One-Step Video Restoration via Diffusion Adversarial Post-Training; code, weights), a one-step diffusion transformer for video and image restoration. The iOS app Still (ν•œμ»·) downloads it on demand as a developer-menu experiment for maximum quality, and uses it on single frames.

SeedVR2 synthesises detail. Restored detail is a prediction, not evidence of captured detail.

Files

Path Purpose
SeedVR2Encoder.mlpackage/ VAE encoder, ML Program (iOS 18+), FP16 weights
SeedVR2DiT0.mlpackage/ … SeedVR2DiT6.mlpackage/ The 32 DiT blocks in seven chunks (0–2, 3–5, 6–8, 9–14, 15–20, 21–26, 27–31), ML Program (iOS 18+), 4-bit weights in 32-weight blocks
SeedVR2Decoder.mlpackage/ VAE decoder, ML Program (iOS 18+), FP16 weights
manifest.json Size and SHA-256 of every file in the packages
LICENSE Apache License 2.0

Interface

All inputs and outputs are float16. Every package is fixed at one 512 Γ— 512 output frame.

Package Inputs Outputs
SeedVR2Encoder image [1, 3, 512, 512], RGB in [-1, 1] latent [4096, 16]
SeedVR2DiT0 latent [4096, 16] vid_out [1024, 2560], txt_out [58, 2560]
SeedVR2DiT1 … SeedVR2DiT5 vid [1024, 2560], txt [58, 2560] vid_out, txt_out
SeedVR2DiT6 vid, txt x0 [4096, 16]
SeedVR2Decoder x0 [4096, 16] image [1, 3, 512, 512], RGB in about [-1, 1]
  • Encoder input. The low-quality frame enlarged to the output size. The reference CLI uses bilinear interpolation on Apple GPUs.
  • Encoder output. The posterior mode Γ— 0.9152, channels last. It is the DiT's conditioning latent.
  • Decoder output. Taken before the CLI's clamp and color correction. The app keeps the decoded detail and takes color and light below about 16 px from the input.
  • Larger images. The app cuts larger areas into 512 px tiles that overlap by 64 px. Neighbouring tiles cross in a 32 px seam in the middle of their overlap.

Measured on iPhone 14 Pro (A16, iOS 18.4), second run, one model resident at a time:

Load Run per frame
Encoder (Neural Engine) 0.3 s 1.7 s
DiT, seven chunks (GPU) 2.8 s 5.0 s
Decoder (Neural Engine) 0.1 s 2.0 s
  • Memory. A four-tile capture peaked at 0.6 GiB for the whole app. The decoder before this revision took 13–15 s to load every time, also a second time in one launch, held 1.4 GB once loaded, and the capture peaked at 1.8 GiB.
  • Encoder on newer Neural Engines. The encoder before this revision did not compile for the Neural Engine of an M4 Mac or, by its load times, an A18 iPhone: Core ML reported ANECCompile() FAILED at every load, never cached the failure, and took 13–22 s to load on the M4 (14–52 s on an iPhone 16 Pro) and 0.70 s a frame. This one loads in 0.07 s after its first compile and runs a frame in 0.12 s on the M4. It has not been measured on an iPhone 14 Pro, where the earlier one compiled.
  • Run the DiT on the GPU (.cpuAndGPU). The A16 Neural Engine computed these iOS 18 compressed weights wrongly. FP16 and the VAE were correct there, and the same packages were correct on an M4 Mac's Neural Engine.

Changes from the original weights

Notice of modifications under section 4(b) of the Apache License 2.0. The source was numz/SeedVR2_comfyUI at revision 09ced71023636e9bc8cdf9cdecfb2625d1e691e8, an FP16 repackaging of ByteDance-Seed/SeedVR2-3B under Apache 2.0:

  • seedvr2_ema_3b_fp16.safetensors, SHA-256 2fd0e03a3dad24e07086750360727ca437de4ecd456f769856e960ae93e2b304
  • ema_vae_fp16.safetensors, SHA-256 20678548f420d98d26f11442d3528f8b8c94e57ee046ef93dbb7633da8612ca1

The following were changed:

  1. Conversion. Converted from PyTorch to Core ML ML Programs for one 512 Γ— 512 output frame. Window indices and rotary positions became constants of that size.
  2. Split. Split the DiT into the seven chunks listed above. The last chunk also takes the single Euler step (x0 = noise βˆ’ v).
  3. Precomputed constants. Some inputs are fixed in one-step restoration, so they were computed once and stored:
    • the timestep embedding for t = 1000;
    • the text conditioning: the published positive prompt embedding (pos_emb.pt) after txt_in;
    • the noise, from seed 42.
  4. FP16 and size changes.
    • RMSNorm divides each token by its largest magnitude before squaring. The text stream reaches 28,640, and xΒ² overflows FP16.
    • The timestep modulation is broadcast instead of repeated per token.
    • Attention is written as matrix products and a softmax.
    • In FP32 these chunks equal the original forward pass: the largest difference was 0.
  5. Quantization. Quantized the DiT weights to 4-bit linear with 32-weight blocks (coremltools 9.0). The VAE stays FP16. On one test frame the decoded image is 34.5 dB from the FP32 model's, and the iPhone 14 Pro output is 56 dB from the Mac's.
  6. Decoder upsamplers for the Neural Engine. Each of the decoder's three upsamplers enlarges with a 1Γ—1Γ—1 convolution and then rearranges its channels, b (x y z c) f h w -> b c (f z) (h x) (w y). Core ML lowered that to reshapes through dimensions of up to 16,777,216, which ran on the CPU between Neural Engine segments (37 operations). For one frame the same result is, for each time index, a 2 Γ— 2 transposed convolution with stride 2 holding the 1Γ—1 convolution's weights, with its position-dependent bias spread the same way from a plane of ones; the time frames the upsampler removes are not computed. In FP32 the rewritten decoder equals the original to 1.4e-5. Every operation now runs on the Neural Engine, and on iPhone 14 Pro its output is 76 dB from the earlier decoder's.
  7. Encoder convolutions folded for one frame. Each causal 3D convolution pads the head of its input with copies of the first frame and then runs a valid 3D convolution. For one frame every output frame sees only copies of that frame, so each of the encoder's 27 such convolutions was replaced by the 2D convolution whose weight is its 3D weight summed over time. One of them, the stride-2-in-time downsampler of the third down block, had made the whole encoder fail the Neural Engine compile on an M4. In FP32 the folded encoder equals the original to 1.9e-5 (relative RMS 3.6e-6); the package is 66 MB instead of 191 MB, and a restored frame through the app is 60.7 dB from the earlier encoder's.

The conversion scripts are kept in the app's repository (research/ReferenceSRStudy).

License

SeedVR2's code and weights are Β© their authors (ByteDance Seed) under the Apache License 2.0 (LICENSE). This conversion is distributed under the same license. This repository is not affiliated with or endorsed by ByteDance or the SeedVR authors.

Training data. The SeedVR authors describe their training data in the paper. It was not reviewed for this conversion, and no warranty is given that any particular use of the weights is free of claims arising from it.

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},
  journal={arXiv preprint arXiv:2506.05301},
  year={2025}
}
Downloads last month
173
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for halfmoon-mind/still-seedvr2

Quantized
(9)
this model

Paper for halfmoon-mind/still-seedvr2