Local music generation

YuE2 local music generation: make vocal songs and arrangements from lyrics

Create a vocal song from lyrics and style with YuE2

YuE2 takes lyrics and musical style, creates a melody-and-chord plan, then outputs a 48 kHz stereo song with vocals and accompaniment combined. You can inspect and revise the score plan, but revisions rerender the whole song rather than editing only part of the waveform.

If you want a short song for a video using your own lyrics, first identify whether you are using YuE v1 or YuE2. The current repository main is YuE2; its README says the original YuE code, documentation, and license are preserved on the YuE-v1 branch. The setup steps, Python API1, 24 GB VRAM2, and RTX 4090 figures below refer to YuE2.

Requirements and key details
  • YuE2 and YuE v1 differ in code, checkpoints, and runtime requirements; keep their setup guides and licenses separate.
  • Check Korean lyric pronunciation and syllable alignment on a short phrase; input support alone does not establish quality.
  • The RTX 4090 result of 71.04 seconds generated 214.85 seconds of audio in a warm run and excludes download, initial loading, and saving.

Check official runtime and memory requirements

The official quick start specifies Linux, Python 3.12, and a BF163-capable NVIDIA GPU4 with 24 GB; the Hugging Face quick start documents CUDA5 and recommends 24 GB of available system RAM6. The model card’s roughly 11 GiB peak for a typical generation is not a minimum card capacity. The RTX 4090 full-mode measurement used 11.18 GiB; the maximum-context test used 14.08 GiB. Memory varies with input length, runtime7, and other GPU workloads.

The current official quick start does not include Apple Silicon Metal8, AMD ROCm9, or native Windows paths. That does not prove other environments are impossible, but the commands and figures here do not establish that they work there. Find a separate upstream runtime path and test it directly.

Install in a Python virtual environment and check the first output

Install in a Python 3.12 virtual environment10 so packages do not mix with other music tools. Weights download on first use, requiring network access and disk space. If no request file is specified, the repository’s default request is used, so specify a new output path. Check the truncated indicator along with the completion message and distinguish incomplete output from a finished song.

After the first run, play outputs/first-song/audio.flac and check whether it matches the lyrics and style. The folder also contains score.abc11, semantic tokens12, acoustic latents13, generation settings, and model identifiers.

Download and install YuE2
git clone https://github.com/multimodal-art-projection/YuE.git
cd YuE
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install .
Run on Linux with the new virtual environment activated.
Generate the first song
python examples/generate.py --output outputs/first-song
Model weights download on the first run.

Understand the default path that combines vocals and accompaniment

The default text-to-music path combines vocals and accompaniment from lyrics and style. Keep genre, instruments, vocal character, and tempo consistent in the style; mark the sung words and sections in the lyrics. Example: “soulful low-mid vocal, slow neo-soul, Rhodes and bass, 82 BPM14.” The default output is 48 kHz stereo, not separated vocal and accompaniment stems.

If you need an instrumental, do not assume that writing “instrumental” in the style removes vocals; test a short sample. If vocals leak into the result, consider a dedicated instrumental path or another program.

A workspace with a lyric sheet beside style notes for genre, tempo, instruments, and vocal character
Separate lyrics and style to review the sung words and arrangement independently.

Review Korean input separately from actual singing

The README mentions multiple languages and publishes English and Chinese examples, while the model-card language tags are Chinese and English. No Korean-specific checkpoint15 or quality evaluation was found. Korean input is separate from pronunciation and lyric accuracy: generate one or two lines before a full song and check for omissions, substitutions, final consonants, liaison, and syllable alignment.

For the first comparison, keep genre and runtime fixed and replay the phrase where pronunciation matters. If there is a problem, adjust lyric syllable count or spacing one at a time and record the input. Have a person review Korean lyrics with important pronunciation requirements before public delivery.

Concept illustration contrasting a finished stereo waveform with separate vocal and accompaniment tracks in a mixer
The default output combines vocals and accompaniment in stereo; check stems separately.

Distinguish the roles of full, melody, and off modes

For a new song, full plans melody and chords before generation. For a cover arrangement, the official documentation recommends melody mode, which plans only the melody and creates accompaniment in a new style. Off generates from lyrics and style without score planning; you can supply your own score as ABC input if it uses supported syntax.

The Python API is plan() → generate_semantic() → synthesize() → decode16(). plan() creates score.abc and plan files; semantic creates music tokens, synthesize creates acoustic latents, and the VAE decoder reconstructs the stereo waveform. This differs from YuE v1’s 7B Stage 1, 1B Stage 2, and XCodec Mini path. Do not mix v1 checkpoints into the YuE2 description.

Diagram showing lyrics and a style prompt passing through score planning, music tokens, and audio rendering into a stereo song
Keeping the score plan lets you regenerate a song from a revised plan.

Revise a score copy and regenerate the whole song

To revise a chorus, keep the original score.abc and change one element in a copy—pitch, rhythm, harmony, or section length. The score edits a plan; it is not a tool for painting over part of an existing waveform, so a revised score rerenders the whole song. You can also resume from a saved plan at the semantic stage.

Rather than overwriting files inside a saved plan, pass a copy of score.abc as the abc argument in a new request. Keep the settings, model identifier, tokens, latents, and truncated status saved by save_artifacts(); store original audio, score, and revisions separately for comparison.

Save the plan and intermediate artifacts
import json
from pathlib import Path
from yue2 import YuE2Pipeline

request = json.loads(Path("examples/song.json").read_text(encoding="utf-8"))
with YuE2Pipeline.from_pretrained("m-a-p/YuE2-3B", device="cuda") as pipe:
    song = pipe(**request)
    song.save_artifacts("outputs/my-song")
    print(song.truncated)
The official Python pipeline form for a GPU environment.

Read published speed and VRAM within their conditions

The model card’s RTX 4090 full run generated 214.85 seconds of audio in 71.04 seconds, about 3.02× real time. It is the average of 32 warm requests after model preparation. Conditions were PyTorch17 2.10, Transformers 4.57.6, CUDA graphs18, FlashAttention19, unquantized BF16 AR/NAR20, FP3221 VAE22, and default YuE2-Vae. Initial path resolution and saving are excluded.

Melody generated 214.67 seconds in 68.68 seconds (11.02 GiB); off generated 196.88 seconds in 57.91 seconds (11.09 GiB). H800 full was a single run generating 224.96 seconds of audio in 54.74 seconds with 10.34 GiB.

Scroll sideways to compare all columns.

YuE2 model-card audio duration, generation time, calculated RTF, and peak memory
Device and modeAudioGenerationRTFPeak memory
RTX 4090 · full214.85 s71.04 s0.33111.18 GiB
RTX 4090 · melody214.67 s68.68 s0.32011.02 GiB
RTX 4090 · off196.88 s57.91 s0.29411.09 GiB
H800 · full (one run)224.96 s54.74 s0.24310.34 GiB
Read YuE2 timing with song duration — YuE2-3B · RTX 4090 · mean of 32 warm requests
RTF is generation time divided by audio duration; lower is faster for the same duration. Initial load and saving are excluded.

Explore broader speed and hardware comparisons

When comparing model-card measurements with your own workflow, align preparation, warm-up, and saving conditions. A separate guide covers how to compare figures across music models.

Check weight terms separately from lyric and recording rights

The official terms dated September 16, 2026 apply Apache 2.0 to code and documentation, and CC BY-NC 4.0 plus additional creator permission to YuE2-3B/VAE weights. Individual content creators and musicians may publish, distribute, sell, license, and monetize generated work without a separate commercial license or rights-holder fee/royalty. Commercial use of the weights themselves by a company is not covered and requires a separate license.

These terms do not grant rights to supplied lyrics, compositions, recordings, or a particular singer’s voice and identity. Check each applicable term when combining other checkpoints, tools, or data or redistributing weights; record the version, license, and necessary permissions before release.

Terminology notes

  1. API — A defined interface that lets other code call a program’s functions.

    Back to the text
  2. VRAM — Memory used by a graphics card’s GPU to store model weights and intermediate values.

    Back to the text
  3. BF16 — A 16-bit floating-point format for model values. Its exponent has the same width as FP32, giving it a similarly wide value range.

    Back to the text
  4. GPU — A processor designed to handle many calculations in parallel. It performs model computations during AI inference.

    Back to the text
  5. CUDA — A software platform for general-purpose computing on NVIDIA GPUs.

    Back to the text
  6. System RAM — System memory that temporarily holds data while programs run.

    Back to the text
  7. Runtime — The software environment that provides facilities needed while a program runs. In local AI, it can also refer to a model execution engine.

    Back to the text
  8. Metal — Apple’s low-level technology for graphics and parallel GPU computation.

    Back to the text
  9. ROCm — AMD’s software platform for AI and high-performance computing on GPUs. Support depends on the combination of GPU, operating system, driver, and framework versions.

    Back to the text
  10. Python virtual environment — An isolated space for installing Python packages per project, helping reduce package-version conflicts.

    Back to the text
  11. ABC notation — A text notation for score information such as pitch and rhythm.

    Back to the text
  12. Token — A unit into which a model divides input or output for processing.

    Back to the text
  13. Latent representation — An intermediate representation in which a model encodes input information compactly. A decoder is usually needed to reconstruct an image, audio, or other output.

    Back to the text
  14. BPM — Short for Beats Per Minute, a tempo measure indicating the number of beats per minute.

    Back to the text
  15. Checkpoint — A file containing saved model weights and related state. Versions or tasks in one model family may use different checkpoints.

    Back to the text
  16. Token decoding — The stage that generates successive output tokens using the input and the response produced so far.

    Back to the text
  17. PyTorch — A software framework for building and running AI models. Check the compatible PyTorch version and hardware support along with the model.

    Back to the text
  18. CUDA Graphs — A CUDA feature that records and reuses a sequence of GPU operations. It can reduce submission overhead.

    Back to the text
  19. FlashAttention — An attention algorithm that computes in tiles, keeps intermediate values in fast on-chip memory, and reduces GPU-memory traffic without storing the full attention matrix.

    Back to the text
  20. AR / NAR — AR (autoregressive) generation proceeds in order, conditioned on prior outputs. NAR (non-autoregressive) generation is less sequential.

    Back to the text
  21. FP32 — A 32-bit floating-point format. It uses more memory per value than BF16 and can represent values more precisely.

    Back to the text
  22. VAE — Short for Variational Autoencoder. It can encode input into a compact latent representation or decode that representation into an output.

    Back to the text

Frequently asked questions

What should you check first in this article?
YuE2 takes lyrics and musical style, creates a melody-and-chord plan, then outputs a 48 kHz stereo song with vocals and accompaniment combined. You can inspect and revise the score plan, but revisions rerender the whole song rather than editing only part of the waveform.
How much memory does it need?
The official quick start specifies Linux, Python 3.12, and a BF16-capable NVIDIA GPU with 24 GB; the Hugging Face quick start documents CUDA and recommends 24 GB of available system RAM. The model card’s roughly 11 GiB peak for a typical generation is not a minimum card capacity. The RTX 4090 full-mode measurement used 11.18 GiB; the maximum-context test used 14.08 GiB. Memory varies with input length, runtime, and other GPU workloads.
When is it better not to choose this?
The official terms dated September 16, 2026 apply Apache 2.0 to code and documentation, and CC BY-NC 4.0 plus additional creator permission to YuE2-3B/VAE weights. Individual content creators and musicians may publish, distribute, sell, license, and monetize generated work without a separate commercial license or rights-holder fee/royalty. Commercial use of the weights themselves by a company is not covered and requires a separate license.
Where can you check the conditions and sources?
The README mentions multiple languages and publishes English and Chinese examples, while the model-card language tags are Chinese and English. No Korean-specific checkpoint or quality evaluation was found. Korean input is separate from pronunciation and lyric accuracy: generate one or two lines before a full song and check for omissions, substitutions, final consonants, liaison, and syllable alignment.