Nodes/YuE2-ComfyUI/YuE2 Write Song
ComfyUI Node

YuE2 Write Song

You don't have to learn the prompt format to get a song

By pytraveler·Created a day ago·Updated about 22 hours ago· 0
YuE2 Write Song
  • options
  • style
  • lyrics
ideaa quiet song about coming home in winter, female voice
model
languageauto
lengthnormal
seed831001
keep_model_loadedfalse
instructions

Everyone has an idea. Nobody wants to learn that style wants language, genre, voice, instruments, melody, phrasing and tempo, and that lyrics wants section markers on their own lines with the words underneath.

YuE2 Write Song takes one sentence - "a sad song about winter, female vocal" - and gives you a filled-in style line and tagged lyrics, wired straight into the generate node. It's the LLM-in-the-graph pattern the image side has been running for two years, applied to the front of a music model: a small local model doing short, structured rewriting so you don't have to.

Inputs and outputs

Six required inputs, and only two or three are decisions you'll revisit:

  • idea - one line, any language. That's the input. If you write it in Russian, the writer follows your lead.
  • model - auto uses a GGUF you already have and only downloads one if you have none (Qwen3.5-4B-Q4_K_M, 2.55 GB, Apache-2.0). The other entries are the GGUFs the pack found in your ComfyUI model folders, in the Hugging Face cache, and in Ollama's own store (listed as ollama: name:tag, read in place - no export, no second copy). Sizes are shown, because fitting on your card is the only fact that matters. LoRA adapters and mmproj files are excluded; they can't answer on their own.
  • language - auto, or English, Russian, Chinese, Japanese, Korean, Spanish, French, German, Italian, Portuguese.
  • length - how long, in words rather than seconds: short asks for 8 sung lines (~108 s of singing), normal 16, long 24, very long 32. It's an aim, not a promise, and the node reports how many lines it actually got. Any instruction-following GGUF works; a 4B on an 8 GB card is enough.
  • seed, and keep_model_loaded - the latter off by default, on purpose: leave the writer resident and YuE2 has 2.5 GB less room to generate in on the same card.

Optional: instructions, in your own words ("no chorus", "first person", "end on a question"). It's appended after the writing rules, so it wins where the two disagree. And options, for the pack's shared settings.

The outputs are style and lyrics, both plain strings, and you plug them into the corresponding inputs on YuE2 Generate Song. Leave max_seconds at 0 in the options and the generate node works its ceiling out from the lyrics it receives, whichever length you asked for.

How it actually runs the model

Two paths, and the node picks for you. If llama-cpp-python is in the same Python environment ComfyUI runs on, the model loads in-process - the fastest option, and the only one where keep_model_loaded means anything. If it isn't, the node fetches about 32 MB of official llama.cpp binaries on first use and writes the song in a subprocess - a few seconds slower, no worse at writing. The wheel is deliberately not a dependency, because on Windows it usually builds from source. An llama.cpp you already have is used as-is, looked for in this order: YUE2_LLAMA_BIN, a path in llama_bin.txt in ComfyUI's user folder, the runtime the pack unpacked, then PATH.

Measured on Qwen3.5-4B-Q4_K_M: one to six seconds a song, and over twenty runs across five line budgets every answer parsed. The one failure it does hit is the classic LLM-node one - a reply that opens with prose instead of a style line. The node spots that and asks once more under a repair prompt before giving up; see the message twice and you want a bigger, more obedient model.

Install

Manager, search YuE2-ComfyUI (listed as YuE2 Music), or:

cd ComfyUI/custom_nodes
git clone https://github.com/pytraveler/YuE2-ComfyUI

Restart after. tiktoken is the pack's only hard dependency - it's not shipped with ComfyUI, and if it's missing the node prints the right pip line for the interpreter ComfyUI is actually using. Optional and worth it: the prebuilt llama-cpp-python wheels linked in the pack's requirements.txt, which buy the in-process path.

One thing worth saying out loud, because this node auto-downloads both a model and a set of binaries: custom nodes are arbitrary Python with full user access, Manager doesn't audit them, and the ecosystem's one serious malware incident was exactly that shape of node. This pack documents every fetch it makes on first run, which is the standard to hold a fresh pack to.

Where it goes wrong

The line count is an aim. In the author's own measurement it came back exact at short, normal and long and four lines over at very long - overshooting is the safe direction, since the length ceiling can cut a song short but can't extend one. The node tells you what it actually wrote, so read that number rather than assuming.

And take the draft as a draft. A 4B model wrote those words, not a songwriter: keep them if they land, or paste your own in and use the node just for the style line. Licences matter if you're going commercial, and note which half is which - the writer model is Apache-2.0 and belongs to neither this pack nor the YuE2 authors, while the YuE2 weights are CC BY-NC 4.0, non-commercial. The song carries that obligation, not the prompt.

CategoryYuE2

Inputs (8)

NameTypeDefaultDescription
ideaSTRINGa quiet song about coming home in winter, female voiceWhat the song is about, in one line. 'a sad song about winter, female vocal' is enough, and so is the same sentence in your own language. Everything the style line needs -- genre, voice, instruments, tempo -- is written for you, so you only have to say what you cannot be bothered to look up.
modelCOMBOThe language model that does the writing. 'auto' uses a GGUF you already have and downloads a 2.7 GB one only if you have none. The other entries are the GGUFs found in your ComfyUI model folders. LoRA adapters and mmproj files are left out: they cannot answer on their own.
languageCOMBOautoWhat language the song is sung in. 'auto' lets the writer follow whatever language your idea is written in, which is usually what you meant.
lengthCOMBOnormalHow long the song should be. 'short' -- 8 sung lines, around 108 seconds of singing 'normal' -- 16 sung lines, around 204 seconds of singing 'long' -- 24 sung lines, around 300 seconds of singing 'very long' -- 32 sung lines, around 360 seconds of singing It is an aim, not a promise: a small model writes somewhat more or fewer lines than asked, and the node says how many it got. 'very long' is about as much as YuE2 sings in one pass. Leave 'max_seconds' at 0 in the options and the generate node works the ceiling out from the lyrics it receives, whichever length you pick here.
seedINT8310010–9223372036854776000The same seed with the same idea gives the same words. Change it for another take on the same idea.
keep_model_loadedBOOLEANfalseKeep the writer in VRAM after it has written. Leave this off when YuE2 generates on the same card afterwards, or the song model has less room to work in.
instructionsoptSTRINGAnything extra for the writer, in your own words: 'no chorus', 'keep it funny', 'first person', 'end on a question'. This goes after the writing rules, so it wins where the two disagree.
optionsoptYUE2_OPTIONS

Outputs (2)

NameTypeDescription
styleSTRING
lyricsSTRING