m-a-p/YuE2-Vae-legacy

Model

4

stars

1

commits

1

repos using this model

1

linked in READMEs

Sep 9, 2026

updated

audio
autoencoder
custom_code
feature-extraction
safetensors
transformers
yue2
yue2_vae

README

YuE logo

🤗 YuE2-Vae-legacy

GitHub   Join Discord

🎧 Demo · 🚀 Quick start · ⚡ Speed · 📊 Benchmarks · 📚 Citation

🤗 YuE2-3B   🤗 YuE2-Vae   🤗 YuE2-Vae-legacy   🤗 MERT-v2-30s   🤗 MERT-v2-FullSong   🤗 WildSongBench   SheetSage2

YuE2-Vae-legacy turns acoustic latents into 48 kHz stereo music. It is the decoder used for YuE2's reported benchmarks, with full-song decoding, an audio encoder, and Hugging Face loading.

Use it with 🤗 YuE2-3B for full-song generation, or load it on its own to encode and decode audio. 🤗 Alternative decoder: YuE2-Vae.

🎧 Listen to YuE2

🎶 Text-to-music

An original song generated from lyrics and a style prompt.

Cyber Metal · English · 5:00

This listening preview uses 🤗 YuE2-Vae.

YuE2 song quality and text alignment on WildSongBench

Complete YuE2 system results on 192 WildSongBench prompts, using symbolic planning. Bo8 means best-of-8.

YuE2 architecture and audio decoder

The VAE turns YuE2's acoustic latents into stereo audio.

🚀 Quick start

For full-song generation, follow the YuE2-3B quick start and select vae="m-a-p/YuE2-Vae-legacy" in YuE2Pipeline.from_pretrained(...).

🔊 Decode saved acoustic latents

Install the tested standalone dependencies:

python -m pip install torch==2.10.0 transformers==4.57.6 huggingface-hub==0.36.2 safetensors==0.7.0 numpy==2.2.6 soundfile==0.13.1

Use latent.npy saved by song.save_artifacts("outputs/song"):

import numpy as np
import soundfile as sf
import torch
from transformers import AutoModel

# Tested FP32 CUDA settings; YuE2Pipeline sets these automatically.
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.allow_tf32 = torch.backends.cuda.matmul.allow_tf32 = False
torch.set_float32_matmul_precision("highest")

repo = "m-a-p/YuE2-Vae-legacy"
vae = AutoModel.from_pretrained(
    repo, trust_remote_code=True, decoder_only=True, device="cuda",
)
z = torch.from_numpy(np.load("outputs/song/latent.npy"))  # [T, 64]
audio = vae.decode_tiled(z.T.unsqueeze(0))                # [1, 2, samples], CPU
sf.write("decoded.flac", audio[0].T.clamp(-1, 1).numpy(), 48000, subtype="PCM_24")
⚙️ Encoding audio and decoding options

decode_tiled bounds memory with 1024-frame cores and 16-frame context. vae.decode(z.T.unsqueeze(0)) offers full decoding; both preserve the natural output length 1920 × T − 64. Keep the VAE in FP32.

🎙️ Encode a short audio clip

encoder = AutoModel.from_pretrained(repo, trust_remote_code=True, device="cpu")
z = encoder.encode(audio[..., :48000])  # First second of the decoded audio

Encoding accepts [batch, 2, samples] audio already at 48 kHz and returns the posterior mean by default. Set sample=True, generator=... for posterior sampling.

⚡ Speed and resources

About 3.5 seconds to decode a 3.6-minute song on an RTX 4090. Each checkpoint is 530.5 MB; decoder-only FP32 weights occupy 253.2 MiB, before activations.

GPUDecoderWarm samplesVAE stage / audio duration
RTX 4090 24GBYuE2-Vae323.63 / 214.85 s
RTX 4090 24GBYuE2-Vae-legacy323.47 / 214.85 s
H800 80GBYuE2-Vae13.04 / 224.96 s
🔎 Measurement details

PyTorch 2.10, FP32, tiled decoding; timings include device transfers. 4090 values average 32 full-CoT songs; H800 is a one-song check. Full-pipeline 4090 peaks were 11.18 GiB with YuE2-Vae and 11.19 GiB with legacy; standalone decoder peak memory was not isolated.

Full-song speed and GPU requirements · WildSongBench and SHS100K results. System benchmark scores use YuE2-Vae-legacy; YuE2-Vae is the default listening decoder.

🔊 Choosing a VAE

In our comparisons, 🤗 YuE2-Vae-legacy achieves higher musicality scores on benchmarks, while 🤗 YuE2-Vae delivers better perceptual audio quality. We recommend YuE2-Vae by default; use YuE2-Vae-legacy when reproducing the paper's benchmark results.

📚 Citation

Technical report coming soon. For now, please cite YuE when using YuE2-Vae-legacy in your research.

@article{yuan2025yue,
  title = {{YuE}: Scaling Open Foundation Models for Long-Form Music Generation},
  author = {Yuan, Ruibin and Lin, Hanfeng and Guo, Shuyue and Zhang, Ge and Pan, Jiahao and Zang, Yongyi and Liu, Haohe and Liang, Yiming and Ma, Wenye and Du, Xingjian and Du, Xinrun and Ye, Zhen and Zheng, Tianyu and Jiang, Zhengxuan and Ma, Yinghao and Liu, Minghao and Tian, Zeyue and Zhou, Ziya and Xue, Liumeng and Qu, Xingwei and Li, Yizhi and Wu, Shangda and Shen, Tianhao and Ma, Ziyang and Zhan, Jun and Wang, Chunhui and Wang, Yatian and Chi, Xiaowei and Zhang, Xinyue and Yang, Zhenzhu and Wang, Xiangzhou and Liu, Shansong and Mei, Lingrui and Li, Peng and Wang, Junjie and Yu, Jianwei and Pang, Guojian and Li, Xu and Wang, Zihao and Zhou, Xiaohuan and Yu, Lijun and Benetos, Emmanouil and Chen, Yong and Lin, Chenghua and Chen, Xie and Xia, Gus and Zhang, Zhaoxiang and Zhang, Chao and Chen, Wenhu and Zhou, Xinyu and Qiu, Xipeng and Dannenberg, Roger and Liu, Jiaheng and Yang, Jian and Huang, Wenhao and Xue, Wei and Tan, Xu and Guo, Yike},
  journal = {arXiv preprint arXiv:2503.08638},
  year = {2025},
  eprint = {2503.08638},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.08638}
}

Weights: CC BY-NC 4.0. Third-party code licenses.

Contributors

a43992899

1 commits

m-a-p/YuE2-Vae-legacy

Model

4

stars

1

commits

1

repos using this model

1

linked in READMEs

Sep 9, 2026

updated

audio
autoencoder
custom_code
feature-extraction
safetensors
transformers
yue2
yue2_vae

README

YuE logo

🤗 YuE2-Vae-legacy

GitHub   Join Discord

🎧 Demo · 🚀 Quick start · ⚡ Speed · 📊 Benchmarks · 📚 Citation

🤗 YuE2-3B   🤗 YuE2-Vae   🤗 YuE2-Vae-legacy   🤗 MERT-v2-30s   🤗 MERT-v2-FullSong   🤗 WildSongBench   SheetSage2

YuE2-Vae-legacy turns acoustic latents into 48 kHz stereo music. It is the decoder used for YuE2's reported benchmarks, with full-song decoding, an audio encoder, and Hugging Face loading.

Use it with 🤗 YuE2-3B for full-song generation, or load it on its own to encode and decode audio. 🤗 Alternative decoder: YuE2-Vae.

🎧 Listen to YuE2

🎶 Text-to-music

An original song generated from lyrics and a style prompt.

Cyber Metal · English · 5:00

This listening preview uses 🤗 YuE2-Vae.

YuE2 song quality and text alignment on WildSongBench

Complete YuE2 system results on 192 WildSongBench prompts, using symbolic planning. Bo8 means best-of-8.

YuE2 architecture and audio decoder

The VAE turns YuE2's acoustic latents into stereo audio.

🚀 Quick start

For full-song generation, follow the YuE2-3B quick start and select vae="m-a-p/YuE2-Vae-legacy" in YuE2Pipeline.from_pretrained(...).

🔊 Decode saved acoustic latents

Install the tested standalone dependencies:

python -m pip install torch==2.10.0 transformers==4.57.6 huggingface-hub==0.36.2 safetensors==0.7.0 numpy==2.2.6 soundfile==0.13.1

Use latent.npy saved by song.save_artifacts("outputs/song"):

import numpy as np
import soundfile as sf
import torch
from transformers import AutoModel

# Tested FP32 CUDA settings; YuE2Pipeline sets these automatically.
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
torch.backends.cudnn.allow_tf32 = torch.backends.cuda.matmul.allow_tf32 = False
torch.set_float32_matmul_precision("highest")

repo = "m-a-p/YuE2-Vae-legacy"
vae = AutoModel.from_pretrained(
    repo, trust_remote_code=True, decoder_only=True, device="cuda",
)
z = torch.from_numpy(np.load("outputs/song/latent.npy"))  # [T, 64]
audio = vae.decode_tiled(z.T.unsqueeze(0))                # [1, 2, samples], CPU
sf.write("decoded.flac", audio[0].T.clamp(-1, 1).numpy(), 48000, subtype="PCM_24")
⚙️ Encoding audio and decoding options

decode_tiled bounds memory with 1024-frame cores and 16-frame context. vae.decode(z.T.unsqueeze(0)) offers full decoding; both preserve the natural output length 1920 × T − 64. Keep the VAE in FP32.

🎙️ Encode a short audio clip

encoder = AutoModel.from_pretrained(repo, trust_remote_code=True, device="cpu")
z = encoder.encode(audio[..., :48000])  # First second of the decoded audio

Encoding accepts [batch, 2, samples] audio already at 48 kHz and returns the posterior mean by default. Set sample=True, generator=... for posterior sampling.

⚡ Speed and resources

About 3.5 seconds to decode a 3.6-minute song on an RTX 4090. Each checkpoint is 530.5 MB; decoder-only FP32 weights occupy 253.2 MiB, before activations.

GPUDecoderWarm samplesVAE stage / audio duration
RTX 4090 24GBYuE2-Vae323.63 / 214.85 s
RTX 4090 24GBYuE2-Vae-legacy323.47 / 214.85 s
H800 80GBYuE2-Vae13.04 / 224.96 s
🔎 Measurement details

PyTorch 2.10, FP32, tiled decoding; timings include device transfers. 4090 values average 32 full-CoT songs; H800 is a one-song check. Full-pipeline 4090 peaks were 11.18 GiB with YuE2-Vae and 11.19 GiB with legacy; standalone decoder peak memory was not isolated.

Full-song speed and GPU requirements · WildSongBench and SHS100K results. System benchmark scores use YuE2-Vae-legacy; YuE2-Vae is the default listening decoder.

🔊 Choosing a VAE

In our comparisons, 🤗 YuE2-Vae-legacy achieves higher musicality scores on benchmarks, while 🤗 YuE2-Vae delivers better perceptual audio quality. We recommend YuE2-Vae by default; use YuE2-Vae-legacy when reproducing the paper's benchmark results.

📚 Citation

Technical report coming soon. For now, please cite YuE when using YuE2-Vae-legacy in your research.

@article{yuan2025yue,
  title = {{YuE}: Scaling Open Foundation Models for Long-Form Music Generation},
  author = {Yuan, Ruibin and Lin, Hanfeng and Guo, Shuyue and Zhang, Ge and Pan, Jiahao and Zang, Yongyi and Liu, Haohe and Liang, Yiming and Ma, Wenye and Du, Xingjian and Du, Xinrun and Ye, Zhen and Zheng, Tianyu and Jiang, Zhengxuan and Ma, Yinghao and Liu, Minghao and Tian, Zeyue and Zhou, Ziya and Xue, Liumeng and Qu, Xingwei and Li, Yizhi and Wu, Shangda and Shen, Tianhao and Ma, Ziyang and Zhan, Jun and Wang, Chunhui and Wang, Yatian and Chi, Xiaowei and Zhang, Xinyue and Yang, Zhenzhu and Wang, Xiangzhou and Liu, Shansong and Mei, Lingrui and Li, Peng and Wang, Junjie and Yu, Jianwei and Pang, Guojian and Li, Xu and Wang, Zihao and Zhou, Xiaohuan and Yu, Lijun and Benetos, Emmanouil and Chen, Yong and Lin, Chenghua and Chen, Xie and Xia, Gus and Zhang, Zhaoxiang and Zhang, Chao and Chen, Wenhu and Zhou, Xinyu and Qiu, Xipeng and Dannenberg, Roger and Liu, Jiaheng and Yang, Jian and Huang, Wenhao and Xue, Wei and Tan, Xu and Guo, Yike},
  journal = {arXiv preprint arXiv:2503.08638},
  year = {2025},
  eprint = {2503.08638},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.08638}
}

Weights: CC BY-NC 4.0. Third-party code licenses.

Contributors

a43992899

1 commits