Tighten YuE for 16GB VRAM and stop the false Waiting status.
Cap Stage-A segments and use a heavier mmgp profile so long lyrics stop OOMing mid-run, and show that Comfy is actually working. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,8 +32,8 @@ function sleep(ms: number) {
|
||||
|
||||
function classifyError(message: string) {
|
||||
const lower = message.toLowerCase()
|
||||
if (lower.includes('out of memory') || (lower.includes('cuda') && lower.includes('alloc')) || lower.includes('vram')) {
|
||||
return 'ComfyUI VRAM allocation failed. Try fewer steps or a shorter duration.'
|
||||
if (lower.includes('out of memory') || lower.includes('exceed allowed memory') || (lower.includes('cuda') && lower.includes('alloc')) || lower.includes('vram')) {
|
||||
return 'ComfyUI ran out of VRAM. For YuE use shorter lyrics (fewer sections) or ACE-Step instead.'
|
||||
}
|
||||
if (lower.includes('econnrefused') || lower.includes('unreachable') || lower.includes('fetch failed')) {
|
||||
return 'ComfyUI host connection dropped. Confirm the desktop instance is running.'
|
||||
@@ -245,11 +245,18 @@ function watchMusicJob(job: Job): Promise<void> {
|
||||
return
|
||||
}
|
||||
const entry = (job.promptId ? history?.[job.promptId] : undefined) as {
|
||||
status?: { status_str?: string; completed?: boolean }
|
||||
status?: {
|
||||
status_str?: string
|
||||
completed?: boolean
|
||||
messages?: Array<[string, Record<string, unknown>]>
|
||||
}
|
||||
} | undefined
|
||||
const status = entry?.status?.status_str
|
||||
if (status === 'error') await fail('ComfyUI reported an execution error')
|
||||
else if (status === 'interrupted') await fail('Job interrupted.')
|
||||
if (status === 'error') {
|
||||
const err = entry?.status?.messages?.find(([type]) => type === 'execution_error')?.[1]
|
||||
const detail = String(err?.exception_message || err?.message || '').trim()
|
||||
await fail(detail || 'ComfyUI reported an execution error')
|
||||
} else if (status === 'interrupted') await fail('Job interrupted.')
|
||||
} catch {
|
||||
// history can miss while the graph is still running
|
||||
}
|
||||
@@ -382,14 +389,19 @@ export async function startMusicJob(params: MusicJobParams) {
|
||||
try {
|
||||
const queued = await queuePrompt(graph, job.clientId, { timeoutMs: 25_000 })
|
||||
if (queued?.prompt_id) job.promptId = queued.prompt_id
|
||||
emitJob(job, { type: 'status', message: 'Job queued on ComfyUI', progress: 8 })
|
||||
const runningMessage = params.engine === 'yue'
|
||||
? 'YuE Stage A on Comfy — 16GB job, often 10–20+ minutes. Leave it alone.'
|
||||
: 'Job queued on ComfyUI'
|
||||
emitJob(job, { type: 'status', message: runningMessage, progress: 8 })
|
||||
} catch (queueError: unknown) {
|
||||
const statusCode = Number((queueError as { statusCode?: number; status?: number })?.statusCode
|
||||
|| (queueError as { status?: number })?.status || 0)
|
||||
if (statusCode >= 400) throw queueError
|
||||
emitJob(job, {
|
||||
type: 'status',
|
||||
message: 'Waiting for ComfyUI to pick up the job...',
|
||||
message: params.engine === 'yue'
|
||||
? 'YuE submitted — waiting for Comfy to start Stage A…'
|
||||
: 'Waiting for ComfyUI to pick up the job...',
|
||||
progress: 8
|
||||
})
|
||||
}
|
||||
|
||||
@@ -116,7 +116,9 @@ function buildYueWorkflow(params: MusicWorkflowParams): WorkflowGraph {
|
||||
const prefix = params.filenamePrefix || musicFilenamePrefix()
|
||||
const tags = params.tags
|
||||
const lyrics = params.lyrics || '[instrumental]\n'
|
||||
const segments = Math.max(1, Math.min(10, lyrics.split(/\[[^\]]+\]/g).filter(part => part.trim()).length || 2))
|
||||
// 5080 16GB OOMs past ~3 long Stage-A segments on fp16+mmgp. Cap hard.
|
||||
const sections = lyrics.split(/\[[^\]]+\]/g).filter(part => part.trim()).length || 2
|
||||
const segments = Math.max(1, Math.min(2, sections))
|
||||
for (const node of Object.values(graph)) {
|
||||
if (node.class_type === 'YUE_Stage_A_Loader') {
|
||||
node.inputs.stage_A_repo = yueStageARepo()
|
||||
@@ -128,8 +130,9 @@ function buildYueWorkflow(params: MusicWorkflowParams): WorkflowGraph {
|
||||
node.inputs.genres_prompt = tags.replace(/,/g, ' ').replace(/\s+/g, ' ').trim()
|
||||
node.inputs.lyrics_prompt = lyrics
|
||||
node.inputs.seed = params.seed
|
||||
node.inputs.prompt_end_time = params.duration
|
||||
node.inputs.prompt_end_time = Math.min(params.duration, 45)
|
||||
node.inputs.run_n_segment = segments
|
||||
node.inputs.max_new_tokens = 2000
|
||||
}
|
||||
}
|
||||
applyPrefix(graph, prefix)
|
||||
|
||||
Reference in New Issue
Block a user