Tighten YuE lyrics validation and Comfy music workflow wiring.

Require section tags before queueing YuE and keep the ACE/YuE path changes that were already in progress.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-03 20:32:41 -05:00
co-authored by Cursor
parent 47f14d7be2
commit 17d4d4ffdc
8 changed files with 114 additions and 29 deletions
+9 -8
View File
@@ -26,8 +26,8 @@ type WorkflowGraph = Record<string, WorkflowNode>
const ACE_V1_CKPT = 'ace_step_v1_3.5b.safetensors'
const ACE_15_CKPT = 'ace_step_1.5_turbo_aio.safetensors'
const YUE_S1_DEFAULT = 'C:\\Users\\ianjm\\AppData\\Local\\Comfy-Desktop\\ComfyUI-Shared\\models\\YuE\\YuE-s1-7B-anneal-en-cot'
const YUE_S2_DEFAULT = 'C:\\Users\\ianjm\\AppData\\Local\\Comfy-Desktop\\ComfyUI-Shared\\models\\YuE\\YuE-s2-1B-general'
const YUE_S1_DEFAULT = 'C:\\Users\\ianjm\\AppData\\Local\\Comfy-Desktop\\ComfyUI-Shared\\models\\yue\\YuE-s1-7B-anneal-en-cot'
const YUE_S2_DEFAULT = 'C:\\Users\\ianjm\\AppData\\Local\\Comfy-Desktop\\ComfyUI-Shared\\models\\yue\\YuE-s2-1B-general'
const YUE_NODE = 'YUE_Stage_A_Loader'
export function musicFilenamePrefix() {
@@ -115,14 +115,14 @@ function buildYueWorkflow(params: MusicWorkflowParams): WorkflowGraph {
const graph = structuredClone(workflowYue as WorkflowGraph)
const prefix = params.filenamePrefix || musicFilenamePrefix()
const tags = params.tags
const lyrics = params.lyrics || '[instrumental]\n'
const lyrics = params.lyrics || '[Instrumental]\n'
// Beast 5080 16GB recipe (keep in sync with workflow_yue.json):
// - mmgp profile 2 only (3–5 enable quanto and crash under Comfy InferenceMode)
// - max 2 Stage-A segments (3+ OOMs)
// - exactly 1 Stage-A lyric section (2+ still OOMs beside xcodec)
// - max_new_tokens floor is 2944 (node min); do not go lower
// - Triton/torch.compile off on Windows
const sections = lyrics.split(/\[[^\]]+\]/g).filter(part => part.trim()).length || 2
const segments = Math.max(1, Math.min(2, sections))
// - xcodec stays on CPU during Stage A (node patch)
const segments = 1
for (const node of Object.values(graph)) {
if (node.class_type === 'YUE_Stage_A_Loader') {
node.inputs.stage_A_repo = yueStageARepo()
@@ -138,10 +138,11 @@ function buildYueWorkflow(params: MusicWorkflowParams): WorkflowGraph {
node.inputs.stage2_batch_size = 1
}
if (node.class_type === 'YUE_Stage_A_Sampler') {
node.inputs.genres_prompt = tags.replace(/,/g, ' ').replace(/\s+/g, ' ').trim()
// Genres go to the model prompt only. Stage-A npy filenames are short (Windows MAX_PATH).
node.inputs.genres_prompt = tags.replace(/,/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 400)
node.inputs.lyrics_prompt = lyrics
node.inputs.seed = params.seed
node.inputs.prompt_end_time = Math.min(params.duration, 45)
node.inputs.prompt_end_time = Math.min(params.duration, 30)
node.inputs.run_n_segment = segments
node.inputs.max_new_tokens = 2944
node.inputs.use_dual_tracks_prompt = false