Mothersuperior/yue2-mothersuperior-realaudio-tokenizer-v4 — new model trending #30 on Hugging Face
Community release ships a real-audio semantic tokenizer and NAR LoRA for YuE2-3B, enabling artist-style song generation and covers from user recordings.
A Hugging Face community release (trending #30) provides an audio-to-semantic-token encoder for YuE2-3B: an 8-layer transformer (d=512) mapping MERT-v2-FullSong layer-20 features at 25 Hz to 32,768 YuE2 semantic codes, with 16.1% held-out top-1 exact match. It also includes a rank-32 LoRA over the NAR branch's 28 layers plus full vae2llm/llm2vae replacement weights, trained on 4,765 YuE2-generated songs then adapted to real audio. Weights ship in .pt, safetensors, bf16, and a ComfyUI-native LoRA layout, with training/inference scripts and an optional YuE2-Vae decoder weight merge (0.666/0.334). Full pipeline runs on a 24 GB GPU (14–18 GB measured with gradient checkpointing).
- Tokenizer head maps MERT-v2-FullSong layer-20 features to 32,768 YuE2 semantic codes at 25 Hz.
- Held-out exact-match top-1 is 16.1%; NAR round-trip ear tests sit around 95%.
- Rank-32 NAR LoRA spans 28 layers; vae2llm/llm2vae ship as full replacement weights.
- Includes ComfyUI-compatible LoRA and optional YuE2-Vae decoder merge (0.666 default / 0.334 legacy).
- AR LoRA training uses a 4,732-song regularizer pack; over ~1,500 steps the model memorizes songs.
Full article1,635 words · extracted from huggingface.co · click to collapse
# yue2-mothersuperior-realaudio-tokenizer-v4
Real-audio tooling for [YuE2-3B](https://huggingface.co/m-a-p/YuE2-3B): the **audio → semantic-token encoder** YuE2 doesn't ship, plus a
**NAR-branch LoRA** so the decoder renders real-production latents. Together they let you tokenize your own recordings, LoRA-tune YuE2's AR on
an artist, and generate new songs or covers.
## Files
| file | what |
|---|---|
| `tokenizer_head_joint_v4.pt` / `.safetensors` / `.bf16.safetensors` | MERT-v2-FullSong layer-20 features (per-track instance-normalised, 25 Hz) → 32,768 YuE2 semantic codes. 8-layer transformer, d=512, 512-frame windows. Held-out exact match on YuE2's own songs: 16.1% top-1 (near-miss codes render almost identically; ear tests of NAR round-trips sit around 95%). |
| `nar_lora_joint_v4.pt` / `.safetensors` / `.bf16.safetensors` / `_comfyui.safetensors` | rank-32 LoRA on `nar_self_attn.{q,k,v,o}_proj` + `nar_mlp.{gate,up,down}_proj` (28 layers) + full `vae2llm`/`llm2vae`. Trained jointly with the head on real audio. |
| `scripts/` | the training loop and inference scripts (below). `scripts/ckpt_io.py` loads either format. |
### Safetensors layout
Same weights as the `.pt` files, bit-exact in fp32 (the `.bf16` variants are half the size; head top-1 agreement with fp32 is 98.6%). All scripts accept either
extension via `scripts/ckpt_io.load_ckpt(path)`, which returns the same dict the `.pt` files hold.
- **Head**: the plain `state_dict` of the 8-layer encoder (`inp.*`, `pos`, `enc.layers.{0..7}.*`, `norm.*`, `head.*`), 103 tensors.
- **NAR LoRA**: `layers.{0..27}.nar_self_attn.{q,k,v,o}_proj.lora_A` `[32, in]` and `.lora_B` `[out, 32]`, plus `layers.{i}.nar_mlp.{gate,up,down}_proj.lora_{A,B}`.
Apply as `W += lora_B @ lora_A` (scale 1.0, no alpha) to the matching `model.layers[i]` Linear of YuE2-3B. `vae2llm.{weight,bias}` and `llm2vae.{weight,bias}`
are **full replacement weights** for those two Linear layers, not LoRA deltas. Rank and the delta rule are also in the file metadata.
### ComfyUI
`nar_lora_joint_v4_comfyui.safetensors` is the same NAR LoRA in ComfyUI's native YuE2 layout: load it with the standard **LoraLoader** on the
**MODEL** output of the YuE2 checkpoint loader (`Comfy-Org/YuE2`, `yue2_3b_bf16.safetensors`), strength 1.0; the CLIP input is untouched by this file.
ComfyUI stores the NAR branch as `diffusion_model.model.layers.{i}.self_attn.qkv_proj` / `o_proj` and `mlp.gate_up_proj` / `down_proj` (q,k,v and
gate,up fused), so the separate q/k/v and gate/up LoRAs are packed as one block-diagonal LoRA per fused matrix (`lora_up`/`lora_down`, no alpha =