Nodes/ComfyUI-FL-YuE2/FL YuE2 · Joint Score Train Config
ComfyUI Node

FL YuE2 · Joint Score Train Config

Two LoRAs, one node, and a KL leash

By filliptm·Created 7 days ago·Updated about 24 hours ago· 129
FL YuE2 · Joint Score Train Config
    • YUE2_TRAIN_CONFIG
    rank32
    learning_rate0.0001
    weight_decay0.0001
    ar_kl_weight0.20
    abc_dropout0.50
    ar_lr_multiplier1.00
    acoustic_window_frames1500
    nar_startbase
    sequence_tokens24576
    allow_truncationfalse
    steps3000
    save_every200
    accumulation1
    seed42

    If you've trained a LoRA on anything in the last two years, you already know the shape of the ritual: dataset in, rank and learning rate out. The FL YuE2 · Joint Score Train Config node is that ritual for YuE2 - except YuE2 isn't one model. It's an autoregressive transformer that writes music tokens from lyrics and style, then a non-autoregressive (NAR) acoustic stage that turns those tokens into 48 kHz stereo audio. This node produces a config object that trains both at once, which is why it exists at all.

    It's the "AI Toolkit-style" recipe the pack calls ai_toolkit_joint_v1. The older FL YuE2 · Train Config is the legacy AR-only path; you swap this one in for a joint run (example_workflows/training_studio.json ships with the legacy node).

    What it actually does

    The node itself is inert. It has no inputs to wire and doesn't touch the GPU - it just packages your settings into a YUE2_TRAIN_CONFIG and hands it to the LoRA Trainer node's optional config input, alongside training assets and a prepared dataset. All the real work happens in the worker.

    Under the hood the trainer installs LoRA weights on the AR transformer projections and a second set on the NAR side, then trains three things per step: full-song AR cross-entropy on your recordings, a KL divergence term against the frozen base model, and sigmoid-timestep flow matching on random windows of acoustic latents. The KL term is the interesting choice - it replaces the replay/regularizer pack legacy AR training needs, which is roughly why the joint recipe measured lighter in the pack's own benchmark (9.03 GB peak versus 11.60 GB, and 1.88× faster, over a 300-step smoke split).

    The settings that matter

    Fourteen fields sounds like a lot. In practice you touch four.

    • rank (default 32) - capacity for both AR and NAR projections. Raise it only if you have the dataset to justify it; the LR schedule is constant, so a big rank on 20 minutes of audio just overfits.
    • abc_dropout (0.5) - the probability a step trains in direct mode, i.e. without the ABC score prefix. This is what keeps plain text-to-music generation working after score-conditioned training. Set it to 0 and you've trained a model that expects a score.
    • ar_kl_weight (0.2) - how hard the adapter is held to the base AR distribution. Up it if your model starts sounding like your dataset and nothing else; drop it toward 0 if you want the LoRA to actually move.
    • nar_start - base or community_v4. base matches the AI Toolkit recipe; community_v4 folds the released acoustic adapter in first. Pick community_v4 only for an explicit A/B, and note the pack's own benchmark says the base-NAR path needs more data before it can beat the community-adapter route.

    The rest are the usual: learning_rate (1e-4), weight_decay (1e-4), ar_lr_multiplier (1.0, scales the AR group only against the shared rate), acoustic_window_frames (1500 - 60 s, since YuE2 runs at 25 frames per second; drop it for smaller cards), sequence_tokens (24576, the max), allow_truncation (off, so an oversized song errors instead of losing its ending), steps (3000), save_every (200), accumulation (1), seed (42).

    Installing and running it

    Same pack, same install as everything else here:

    cd ComfyUI/custom_nodes
    git clone https://github.com/filliptm/ComfyUI-FL-YuE2.git
    cd ComfyUI-FL-YuE2
    python -m pip install -r requirements.txt
    python -m pip install -r requirements-training.txt
    

    The second file is the one that matters here - google-genai, transformers, soundfile, scipy, demucs==4.0.1. Install it into the Python environment that runs ComfyUI; the workers install nothing for you. Then restart, queue Training Models with download_missing on, and expect multi-GB pulls (base weights, MERT-v2-FullSong, the v4 tokenizer head, the regularizer pack).

    Where people get burned

    • Your prepared dataset must have score tokens. In Prepare Dataset, set score_planning to melody or full - with it off, the trainer refuses to start outright. If you don't have .abc.txt sidecars, enable transcribe_missing_scores and let pinned SheetSage2 write them (CC BY-NC 4.0).
    • It needs real recordings, both splits. The joint recipe trains on your audio, not a replay pack, and it requires at least one train and one validation song. A "dataset" of two files technically runs and technically overfits.
    • Resume is signature-checked. Config, dataset fingerprint, model revision and assets all go into a fingerprint; change any one and your resume.pt is rejected. Joint runs also can't resume from a legacy AR checkpoint - start fresh.
    • You get two files, not one. Each checkpoint writes step-NNNNNN.safetensors and step-NNNNNN-nar.safetensors under models/loras/YuE2/<run>/. Copy them together. Load LoRA picks up both automatically, and the NAR adapter scales the entire acoustic companion including its pretrained component.

    One expectation to set: on the pack's tiny benchmark, neither trained AR adapter beat the base model on the single held-out recording. Validate on a real artist dataset with your own ears - this isn't a button that makes the model better.

    CategoryFL YuE2/Training

    Inputs (14)

    NameTypeDefaultDescription
    rankINT321–128LoRA rank for both AR and NAR transformer projections.
    learning_rateFLOAT0.00011e-7–0.01
    weight_decayFLOAT0.00010–0.1
    ar_kl_weightFLOAT0.200–2KL(base || adapter) weight used to preserve the base AR distribution.
    abc_dropoutFLOAT0.500–1Probability of training an example in direct mode without its score.
    ar_lr_multiplierFLOAT1.000.01–2
    acoustic_window_framesINT150064–3000Random NAR flow-matching window. YuE2 uses 25 frames per second.
    nar_startCOMBObaseAI Toolkit starts from base NAR; community_v4 folds the released acoustic adapter first.
    sequence_tokensINT24576256–24576
    allow_truncationBOOLEANfalse
    stepsINT30001–100000
    save_everyINT2001–5000
    accumulationINT11–64
    seedINT420–2147483647

    Outputs (1)

    NameTypeDescription
    YUE2_TRAIN_CONFIGYUE2_TRAIN_CONFIG