xocialize commited on
Commit
131d52a
·
verified ·
1 Parent(s): c3271a7

Add Bernini-R-1.3B MLX (single-expert Wan2.1-1.3B renderer)

Browse files
Files changed (6) hide show
  1. NOTICE +23 -0
  2. README.md +81 -0
  3. config.json +48 -0
  4. model.safetensors +3 -0
  5. t5_encoder.safetensors +3 -0
  6. vae.safetensors +3 -0
NOTICE ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ bernini-r-mlx (1.3B tier)
2
+ Apache MLX port of ByteDance Bernini-R-1.3B (the Bernini Renderer, small tier).
3
+
4
+ This work is licensed under the Apache License, Version 2.0.
5
+
6
+ It is derived from and depends on the following Apache-2.0 works; their notices
7
+ and attributions are retained here:
8
+
9
+ - ByteDance/Bernini-R-1.3B — the Bernini Renderer, 1.3B tier (weights + reference
10
+ inference code).
11
+ https://github.com/bytedance/Bernini · https://huggingface.co/ByteDance/Bernini-R-1.3B-Diffusers
12
+ Paper: "Bernini: Latent Semantic Planning for Video Diffusion" (arXiv:2605.22344).
13
+
14
+ - Wan-AI/Wan2.1-T2V-1.3B — the base DiT, 16-channel causal VAE, and UMT5 text encoder
15
+ that Bernini-R-1.3B fine-tunes / reuses. https://github.com/Wan-Video/Wan2.1
16
+
17
+ - Qwen2.5-VL-7B-Instruct — the Bernini *planner* (NOT used here; not released as weights).
18
+
19
+ - mlx-video (Blaizzy/mlx-video) — the MLX Wan backbone reused by this port.
20
+
21
+ Scope note: only the Bernini *Renderer* is open-sourced upstream. The MLLM semantic
22
+ planner (the paper's "latent semantic planning") is not released, so this port runs with
23
+ UMT5 text conditioning only; the planner-feature channel is absent.
README.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: mlx
4
+ pipeline_tag: text-to-video
5
+ tags:
6
+ - mlx
7
+ - text-to-video
8
+ - video-editing
9
+ - video-to-video
10
+ - reference-to-video
11
+ - wan2.1
12
+ - bernini
13
+ base_model: ByteDance/Bernini-R-1.3B-Diffusers
14
+ ---
15
+
16
+ # Bernini-R-1.3B (MLX)
17
+
18
+ Apple MLX port of **[ByteDance/Bernini-R-1.3B](https://huggingface.co/ByteDance/Bernini-R-1.3B-Diffusers)** —
19
+ the **1.3B** tier of ByteDance's Bernini *Renderer*: a Wan2.1-T2V-1.3B-derived video
20
+ generator/editor with **Segment-Aware 3D RoPE** for multi-reference / editing tasks.
21
+ The small tier "performs close to the 14B variant on simple tasks such as style transfer,
22
+ subtitle or watermark removal, and local editing."
23
+
24
+ Runs on Apple Silicon via [MLX](https://github.com/ml-explore/mlx) + the
25
+ [mlx-video](https://github.com/Blaizzy/mlx-video) Wan backbone.
26
+
27
+ > **This is the lowest-cost Bernini tier.** For the higher-quality A14B renderer see
28
+ > [`mlx-community/Bernini-R-bf16`](https://huggingface.co/mlx-community/Bernini-R-bf16) /
29
+ > [`-int4`](https://huggingface.co/mlx-community/Bernini-R-int4).
30
+
31
+ ## ⚠️ Scope: renderer only
32
+
33
+ Only the Renderer ("-R") is open-sourced upstream. The MLLM semantic **planner** (the
34
+ paper's headline "latent semantic planning", a Qwen2.5-VL-7B model) is **not released**.
35
+ This port therefore runs with **UMT5 text conditioning only** — the planner-feature
36
+ channel is absent (and carries no weights in the released checkpoint).
37
+
38
+ ## Architecture
39
+
40
+ | | |
41
+ |---|---|
42
+ | Backbone | **Wan2.1-T2V-1.3B**, single expert (30L · dim 1536 · 12H · ffn 8960) |
43
+ | Experts | **one** (`skip_transformer_2: true`, `switch_dit_boundary: 0`) |
44
+ | VAE | 16-ch `AutoencoderKLWan` (stock Wan2.1) |
45
+ | Text encoder | UMT5-xxl |
46
+ | Bernini knobs | `shift 3.0`, `use_src_id_rotary_emb` (SA-3D RoPE — **no extra parameters**) |
47
+
48
+ Differs from the A14B port only by config: a single 1.3B expert instead of the
49
+ high/low-noise A14B pair. There is no expert-boundary switch.
50
+
51
+ ## Tasks
52
+
53
+ | Task | Description |
54
+ |---|---|
55
+ | `t2v` / `t2i` | text-to-video / image |
56
+ | `r2v` | reference-to-video — generate a subject from up to K reference images (chained APG) |
57
+ | `v2v` | prompt-based video editing (source video injected as conditioning) |
58
+ | `rv2v` | reference + video editing |
59
+
60
+ ## Variants
61
+
62
+ | Repo | Precision | Transformer | + shared |
63
+ |---|---|---|---|
64
+ | `…-1.3B-bf16` | bfloat16 | 2.6 GB | VAE 0.5 GB · UMT5 10.6 GB |
65
+ | `…-1.3B-int4` | 4-bit (group 64) | 0.8 GB | VAE 0.5 GB · UMT5 10.6 GB |
66
+
67
+ ## Provenance & validation
68
+
69
+ - Architecture: **stock Wan2.1-T2V-1.3B** (verified — diffusers `WanTransformer3DModel`
70
+ keys, no extra tensors; matches `mlx-video` `wan21_t2v_1_3b` exactly: 30L/1536/12H/8960).
71
+ Bernini knobs (`switch_dit_boundary 0`, `shift 3.0`, `use_src_id_rotary_emb`) live in
72
+ the wrapper config; SA-3D RoPE adds **no parameters**.
73
+ - Converted fp32 → bf16 from `ByteDance/Bernini-R-1.3B-Diffusers`; VAE/UMT5 are the shared
74
+ stock Wan2.1 components (byte-identical to the A14B port).
75
+ - Validated on the CPU stream: key contract bijective (825 file tensors = model params
76
+ minus the derived `freqs` rope buffer); **bf16 forward cosine 0.999983 vs source fp32**;
77
+ int4 per-pass cosine **0.9943** vs bf16 (group 64, ≥0.99 gate).
78
+
79
+ ## License & attribution
80
+
81
+ Apache-2.0. Derived from ByteDance Bernini-R, Wan2.1 (Wan-AI), and mlx-video. See `NOTICE`.
config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "t2v",
3
+ "model_version": "2.1",
4
+ "patch_size": [
5
+ 1,
6
+ 2,
7
+ 2
8
+ ],
9
+ "text_len": 512,
10
+ "in_dim": 16,
11
+ "dim": 1536,
12
+ "ffn_dim": 8960,
13
+ "freq_dim": 256,
14
+ "text_dim": 4096,
15
+ "out_dim": 16,
16
+ "num_heads": 12,
17
+ "num_layers": 30,
18
+ "window_size": [
19
+ -1,
20
+ -1
21
+ ],
22
+ "qk_norm": true,
23
+ "cross_attn_norm": true,
24
+ "eps": 1e-06,
25
+ "vae_stride": [
26
+ 4,
27
+ 8,
28
+ 8
29
+ ],
30
+ "vae_z_dim": 16,
31
+ "dual_model": false,
32
+ "boundary": 0.0,
33
+ "sample_shift": 3.0,
34
+ "sample_steps": 50,
35
+ "sample_guide_scale": 5.0,
36
+ "num_train_timesteps": 1000,
37
+ "sample_fps": 16,
38
+ "frame_num": 81,
39
+ "sample_neg_prompt": "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走",
40
+ "max_area": 0,
41
+ "t5_vocab_size": 256384,
42
+ "t5_dim": 4096,
43
+ "t5_dim_attn": 4096,
44
+ "t5_dim_ffn": 10240,
45
+ "t5_num_heads": 64,
46
+ "t5_num_layers": 24,
47
+ "t5_num_buckets": 32
48
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:212747be887cfd8b584d0a6f3d83299714af0da411e29716c1820b6d8637956f
3
+ size 2838077537
t5_encoder.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e86ee4199903e00a88dcd43583a43a6eb898cef600e38670f222d7e37d163787
3
+ size 11361845505
vae.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:977530e453dbfabbab31e2972e1577d8d7e2840ba7410c81aa3fd421c0cd7414
3
+ size 507591226