File size: 3,290 Bytes
bf68acd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76528e0
 
 
 
bf68acd
 
 
 
 
 
88a2108
c2d7c73
88a2108
c2d7c73
88a2108
 
 
 
bf68acd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c2d7c73
bf68acd
 
bc11697
 
218f8cc
 
bf68acd
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
export type PlanMode = "full" | "melody";

export type OutputFormat = "flac" | "mp3" | "opus";

/**
 * How the symbolic plan (ABC score) that YuE2 conditions on is produced.
 * - "model"      YuE2GenerateABC writes the score from style + lyrics
 * - "reference"  SheetSage2AudioToABC transcribes an uploaded recording
 * - "manual"     the operator supplies or edits the score by hand
 * - "none"       no score at all, YuE2 falls back to off mode
 */
export type ScoreSource = "model" | "reference" | "manual" | "none";

export interface GenerationRequest {
  style: string;
  lyrics: string;
  mode: PlanMode;
  scoreSource: ScoreSource;
  abc: string;
  referenceFilename: string | null;
  /** Seconds into the reference to start transcribing. */
  referenceStart: number;
  /** Seconds of reference to transcribe, or null for all of it. */
  referenceDuration: number | null;
  maxDuration: number;
  seed: number;
  randomizeSeed: boolean;
  checkpoint: string;
  audioEncoder: string;
  tiledDecode: boolean;
  /** Load the community Real-Audio decoder adapter (MODEL branch). */
  realAudioMatch: boolean;
  /** How hard that adapter pulls, 0 to 1.5. */
  realAudioStrength: number;
  /** Load the instrumental chain-of-thought adapter (CLIP branch). */
  instrumentalArrangement: boolean;
  /** How hard that adapter pulls, 0 to 1.5. */
  instrumentalStrength: number;
  outputFormat: OutputFormat;
  advanced: AdvancedParams;
}

export interface AdvancedParams {
  temperature: number;
  topP: number;
  topK: number;
  repetitionPenalty: number;
  cfgScale: number;
  steps: number;
  samplerName: string;
  scheduler: string;
  abcTemperature: number;
  abcTopP: number;
  abcTopK: number;
  abcRepetitionPenalty: number;
  maxAbcTokens: number;
}

export type JobStage =
  | "queued"
  | "transcribing"
  | "planning"
  | "conditioning"
  | "rendering"
  | "decoding"
  | "done"
  | "failed"
  | "cancelled";

export interface JobAudio {
  filename: string;
  subfolder: string;
  type: string;
  url: string;
}

export interface Job {
  id: string;
  promptId: string | null;
  createdAt: number;
  finishedAt: number | null;
  stage: JobStage;
  /** 0 to 1 within the current stage. */
  stageProgress: number;
  /** False when the websocket is unreachable and stages come from polling. */
  liveProgress: boolean;
  queuePosition: number | null;
  request: GenerationRequest;
  seedUsed: number;
  abc: string | null;
  audio: JobAudio | null;
  durationSeconds: number | null;
  error: string | null;
  title: string;
}

export interface ComfyCapabilities {
  connected: boolean;
  url: string;
  mock: boolean;
  checkpoints: string[];
  audioEncoders: string[];
  loras: string[];
  missingNodes: string[];
  error: string | null;
  /** Tail of the engine log, so a remote failure explains itself. */
  engineLog: string | null;
  /** Identifies the running image, so a stale container is obvious. */
  buildStamp: string | null;
}

export const STAGE_LABEL: Record<JobStage, string> = {
  queued: "Waiting for the GPU",
  transcribing: "Reading the reference",
  planning: "Writing the score",
  conditioning: "Encoding style and lyrics",
  rendering: "Rendering audio",
  decoding: "Decoding to stereo",
  done: "Ready",
  failed: "Failed",
  cancelled: "Cancelled",
};