Instructions to use benc0/SeedVR2-7B-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use benc0/SeedVR2-7B-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir SeedVR2-7B-mlx benc0/SeedVR2-7B-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
library_name: mlx
|
|
|
|
| 4 |
tags:
|
| 5 |
- mlx
|
|
|
|
| 6 |
- mlx-swift
|
| 7 |
- super-resolution
|
| 8 |
- image-upscaling
|
|
@@ -11,38 +13,52 @@ tags:
|
|
| 11 |
pipeline_tag: image-to-image
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# SeedVR2-7B (MLX
|
| 15 |
|
| 16 |
-
**MLX-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
|
| 23 |
- **Files:** `transformer.safetensors` (DiT, fp16, ~16.5 GB) · `vae.safetensors` (3D-causal-conv VAE, fp16) · `pos_emb.safetensors` (precomputed text embedding, 58×5120) · `config.json`.
|
| 24 |
- **Architecture (vs 3B):** vid_dim 3072 (2560), 24 heads (20), 36 layers (32), all layers multimodal, plain MLP (SwiGLU), rope_dim 64.
|
| 25 |
-
- **Precision:** fp16.
|
| 26 |
-
- **Memory:** ~17 GB weights resident; recommended 32 GB+ unified memory (use the int8 variant
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
```swift
|
| 31 |
-
import SeedVR2MLX // github.com/xocialize/seedvr2-mlx-swift
|
| 32 |
let upscaler = try SeedVR2Upscaler(directory: weightsDir) // downloaded from this repo
|
| 33 |
let out = upscaler.upscale(processedImage: img, seed: 42) // [-1,1], dims padded to /16
|
| 34 |
```
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
## Provenance & license
|
| 39 |
|
| 40 |
-
Chain: **ByteDance Seed** — *SeedVR2: One-Step Video Restoration via Diffusion Adversarial
|
| 41 |
-
Post-Training* (ICLR 2026), [ByteDance-Seed/SeedVR](https://github.com/ByteDance-Seed/SeedVR),
|
| 42 |
-
**Apache-2.0** → PyTorch fp16 redistribution [`numz/SeedVR2_comfyUI`](https://huggingface.co/numz/SeedVR2_comfyUI)
|
| 43 |
-
(`seedvr2_ema_7b_fp16.safetensors`; independently verified bitwise against ByteDance's original fp32
|
| 44 |
-
`seedvr2_ema_7b.pth` — all 1128 tensors identical after fp32→fp16 cast) → MLX reference impl
|
| 45 |
-
[`filipstrand/mflux`](https://github.com/filipstrand/mflux) → export via
|
| 46 |
-
[`xocialize/seedvr2-mlx`](https://github.com/xocialize/seedvr2-mlx) tooling. These are
|
| 47 |
-
format-converted weight artifacts (not a new model); Apache-2.0 applies. Credit ByteDance Seed
|
| 48 |
-
(original), cite the paper (arXiv:2506.05301).
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
library_name: mlx
|
| 4 |
+
base_model: ByteDance-Seed/SeedVR2-7B
|
| 5 |
tags:
|
| 6 |
- mlx
|
| 7 |
+
- mflux
|
| 8 |
- mlx-swift
|
| 9 |
- super-resolution
|
| 10 |
- image-upscaling
|
|
|
|
| 13 |
pipeline_tag: image-to-image
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# SeedVR2-7B (MLX) — fp16
|
| 17 |
|
| 18 |
+
Runtime-agnostic **MLX-format** weights (fp16) for **SeedVR2-7B**, ByteDance's one-step diffusion **super-resolution / restoration** model (ICLR 2026), for on-device upscaling on Apple Silicon.
|
| 19 |
+
|
| 20 |
+
Not tied to any single package — these load into:
|
| 21 |
+
- [`mflux`](https://github.com/filipstrand/mflux) (Python MLX, actively maintained; also the parity reference these weights were validated against),
|
| 22 |
+
- [`seedvr2-mlx-swift`](https://github.com/xocialize/seedvr2-mlx-swift) (MLX-Swift; **archived/read-only since Jun 2026** but functional — MIT-licensed and forkable),
|
| 23 |
+
- or any MLX code that reconstructs the same module tree (see **Format notes** below).
|
| 24 |
+
|
| 25 |
+
int8 variant: [`SeedVR2-7B-mlx-int8`](https://huggingface.co/benc0/SeedVR2-7B-mlx-int8) · sharp checkpoint: [`SeedVR2-7B-sharp-mlx`](https://huggingface.co/benc0/SeedVR2-7B-sharp-mlx) · 3B family: [`mlx-community/SeedVR2-3B-mlx`](https://huggingface.co/mlx-community/SeedVR2-3B-mlx)
|
| 26 |
|
| 27 |
- **Files:** `transformer.safetensors` (DiT, fp16, ~16.5 GB) · `vae.safetensors` (3D-causal-conv VAE, fp16) · `pos_emb.safetensors` (precomputed text embedding, 58×5120) · `config.json`.
|
| 28 |
- **Architecture (vs 3B):** vid_dim 3072 (2560), 24 heads (20), 36 layers (32), all layers multimodal, plain MLP (SwiGLU), rope_dim 64.
|
| 29 |
+
- **Precision:** fp16. Transformer reload vs the mflux reference (CPU): `t_out` max_abs **0.00e+00 (bit-exact)**. End-to-end GPU vs CPU pipeline: 60 dB PSNR.
|
| 30 |
+
- **Memory:** ~17 GB weights resident; recommended 32 GB+ unified memory (below that, use the int8 variant).
|
| 31 |
+
|
| 32 |
+
## Usage — Python (MLX / mflux)
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
import json, mlx.core as mx
|
| 36 |
+
from mlx.utils import tree_unflatten
|
| 37 |
+
from mflux.models.seedvr2.model.seedvr2_transformer.transformer import SeedVR2Transformer
|
| 38 |
|
| 39 |
+
cfg = json.load(open("config.json"))
|
| 40 |
+
tx = SeedVR2Transformer(**cfg["transformer_overrides"])
|
| 41 |
+
tx.update(tree_unflatten(list(mx.load("transformer.safetensors").items())))
|
| 42 |
+
mx.eval(tx.parameters()) # bit-exact vs the mflux reference (verified at export)
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
The full pipeline (VAE, scheduler, pre/post-processing) lives in mflux: `mflux-upscale-seedvr2 --model seedvr2-7b --image-path input.png --resolution 2x` (note: mflux's built-in downloader fetches the PyTorch source weights and converts on the fly; loading *these* pre-converted files uses the snippet above).
|
| 46 |
+
|
| 47 |
+
## Usage — Swift
|
| 48 |
|
| 49 |
```swift
|
| 50 |
+
import SeedVR2MLX // github.com/xocialize/seedvr2-mlx-swift (archived/read-only, MIT — fork to maintain)
|
| 51 |
let upscaler = try SeedVR2Upscaler(directory: weightsDir) // downloaded from this repo
|
| 52 |
let out = upscaler.upscale(processedImage: img, seed: 42) // [-1,1], dims padded to /16
|
| 53 |
```
|
| 54 |
|
| 55 |
+
## Format notes (for other MLX runtimes)
|
| 56 |
+
|
| 57 |
+
- **Key naming:** mflux module hierarchy, flattened with `mlx.utils.tree_flatten` (e.g. `blocks.17.attn.proj_qkv_vid.weight`). Deterministic mapping back to ByteDance's original PyTorch names: mflux `src/mflux/models/seedvr2/weights/seedvr2_weight_mapping.py`.
|
| 58 |
+
- **Layouts:** MLX conventions throughout — VAE conv weights are `(O, *K, I)`.
|
| 59 |
+
- **Config:** `config.json["transformer_overrides"]` carries the 7B dims (vid_dim 3072, heads 24, num_layers 36, mm_layers 36, rope_dim 64, …) and must be passed to the transformer constructor.
|
| 60 |
+
- **Conditioning:** `pos_emb.safetensors` (58×5120, fp16) is the precomputed embedding of the fixed prompt — the text encoder is eliminated from this port, so it is a mandatory `txt` input.
|
| 61 |
|
| 62 |
## Provenance & license
|
| 63 |
|
| 64 |
+
Chain: **ByteDance Seed** — *SeedVR2: One-Step Video Restoration via Diffusion Adversarial Post-Training* (ICLR 2026, [arXiv:2506.05301](https://arxiv.org/abs/2506.05301)), [ByteDance-Seed/SeedVR](https://github.com/ByteDance-Seed/SeedVR), **Apache-2.0** → PyTorch fp16 redistribution [`numz/SeedVR2_comfyUI`](https://huggingface.co/numz/SeedVR2_comfyUI) (`seedvr2_ema_7b_fp16.safetensors`; independently verified **bitwise** against ByteDance's original fp32 `seedvr2_ema_7b.pth` — all 1128 tensors identical after fp32→fp16 cast) → MLX reference impl [`filipstrand/mflux`](https://github.com/filipstrand/mflux) → export via [`xocialize/seedvr2-mlx`](https://github.com/xocialize/seedvr2-mlx) tooling. These are format-converted weight artifacts (not a new model); Apache-2.0 applies. Credit ByteDance Seed (original), cite the paper.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|