comfyui-node 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -9
- package/dist/.tsbuildinfo +1 -1
- package/dist/call-wrapper.d.ts.map +1 -1
- package/dist/call-wrapper.js +859 -856
- package/dist/call-wrapper.js.map +1 -1
- package/dist/client.d.ts +27 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +87 -6
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/multipool/multi-workflow-pool.d.ts.map +1 -1
- package/dist/multipool/multi-workflow-pool.js +61 -30
- package/dist/multipool/multi-workflow-pool.js.map +1 -1
- package/dist/pool/WorkflowPool.d.ts.map +1 -1
- package/dist/pool/WorkflowPool.js +855 -845
- package/dist/pool/WorkflowPool.js.map +1 -1
- package/dist/pool/client/ClientManager.js +215 -215
- package/dist/pool/index.js +3 -3
- package/dist/pool/types/job.d.ts +15 -0
- package/dist/pool/types/job.d.ts.map +1 -1
- package/dist/types/event.d.ts +17 -1
- package/dist/types/event.d.ts.map +1 -1
- package/dist/utils/model-loading.d.ts +158 -0
- package/dist/utils/model-loading.d.ts.map +1 -0
- package/dist/utils/model-loading.js +273 -0
- package/dist/utils/model-loading.js.map +1 -0
- package/package.json +9 -5
package/dist/types/event.d.ts
CHANGED
|
@@ -122,7 +122,7 @@ export type TExecutionInterrupted = TExecution & {
|
|
|
122
122
|
/**
|
|
123
123
|
* Union type of all ComfyUI API event keys
|
|
124
124
|
*/
|
|
125
|
-
export type ComfyApiEventKey = "all" | "auth_error" | "connection_error" | "auth_success" | "status" | "progress" | "executing" | "executed" | "disconnected" | "execution_success" | "execution_start" | "execution_error" | "execution_cached" | "queue_error" | "reconnected" | "connected" | "log" | "terminal" | "reconnecting" | "b_preview" | "b_preview_meta" | "b_text" | "b_text_meta" | "b_preview_raw" | "node_text_update";
|
|
125
|
+
export type ComfyApiEventKey = "all" | "auth_error" | "connection_error" | "auth_success" | "status" | "progress" | "executing" | "executed" | "disconnected" | "execution_success" | "execution_start" | "execution_error" | "execution_cached" | "queue_error" | "reconnected" | "reconnection_failed" | "connected" | "log" | "terminal" | "reconnecting" | "b_preview" | "b_preview_meta" | "b_text" | "b_text_meta" | "b_preview_raw" | "node_text_update" | "websocket_unavailable" | "shutdown_started" | "shutdown_complete";
|
|
126
126
|
/**
|
|
127
127
|
* Type mapping ComfyUI API event keys to their respective CustomEvent types
|
|
128
128
|
*/
|
|
@@ -170,6 +170,22 @@ export type TComfyAPIEventMap = {
|
|
|
170
170
|
* Reconnected event
|
|
171
171
|
*/
|
|
172
172
|
reconnected: CustomEvent<null>;
|
|
173
|
+
/**
|
|
174
|
+
* Reconnection failed event (after all retry attempts exhausted)
|
|
175
|
+
*/
|
|
176
|
+
reconnection_failed: CustomEvent<null>;
|
|
177
|
+
/**
|
|
178
|
+
* WebSocket unavailable event (when WebSocket creation fails and polling fallback is used)
|
|
179
|
+
*/
|
|
180
|
+
websocket_unavailable: CustomEvent<Error>;
|
|
181
|
+
/**
|
|
182
|
+
* Shutdown started event
|
|
183
|
+
*/
|
|
184
|
+
shutdown_started: CustomEvent<null>;
|
|
185
|
+
/**
|
|
186
|
+
* Shutdown complete event
|
|
187
|
+
*/
|
|
188
|
+
shutdown_complete: CustomEvent<null>;
|
|
173
189
|
/**
|
|
174
190
|
* Binary preview image event
|
|
175
191
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/types/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;I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SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,YAAY,GACZ,kBAAkB,GAClB,cAAc,GACd,QAAQ,GACR,UAAU,GACV,WAAW,GACX,UAAU,GACV,cAAc,GACd,mBAAmB,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,WAAW,GACX,KAAK,GACL,UAAU,GACV,cAAc,GACd,WAAW,GACX,gBAAgB,GAChB,QAAQ,GACR,aAAa,GACb,eAAe,GACf,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/types/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,MAAM,EAAE;QACN;;WAEG;QACH,SAAS,EAAE;YACT;;eAEG;YACH,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC;KACH,CAAC;IACF;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb,C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AAC;IAC5E;;OAEG;IACH,SAAS,EAAE,WAAW,CAAC;QAAE,MAAM,EAAE,QAAQ,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC;QAAE,MAAM,EAAE,QAAQ,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/D;;OAEG;IACH,eAAe,EAAE,WAAW,CAAC;QAC3B,MAAM,EAAE,QAAQ,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,KAAK,CAAC;QACb,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH;;OAEG;IACH,cAAc,EAAE,WAAW,CAAC;QAC1B,MAAM,EAAE,QAAQ,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,aAAa,CAAC;KACrB,CAAC,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model loading detection utilities.
|
|
3
|
+
*
|
|
4
|
+
* These utilities help identify when ComfyUI is loading models (a typically slow operation)
|
|
5
|
+
* vs. executing standard workflow nodes. This is useful for applying adaptive timeouts
|
|
6
|
+
* and providing better progress feedback to users.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* List of node types that typically load models from disk.
|
|
10
|
+
* These operations can be very slow on first execution (cold start).
|
|
11
|
+
*/
|
|
12
|
+
export declare const MODEL_LOADING_NODE_TYPES: readonly ["CheckpointLoaderSimple", "CheckpointLoader", "unCLIPCheckpointLoader", "VAELoader", "VAEDecode", "LoraLoader", "LoraLoaderModelOnly", "ControlNetLoader", "ControlNetApply", "ControlNetApplyAdvanced", "IPAdapterModelLoader", "IPAdapterApply", "CLIPLoader", "DualCLIPLoader", "CLIPVisionLoader", "UNETLoader", "DiffusersLoader", "StyleModelLoader", "UpscaleModelLoader", "GLIGENLoader", "PhotoMakerLoader", "InstantIDModelLoader", "AnimateDiffLoader", "ADE_AnimateDiffLoaderGen1", "ADE_AnimateDiffLoaderGen2", "FluxCheckpointLoader", "SD3CheckpointLoader", "comfy.sd1.CheckpointLoader", "comfy.sd2.CheckpointLoader", "comfy.sdxl.CheckpointLoader"];
|
|
13
|
+
/**
|
|
14
|
+
* Check if a node type is a model loading node.
|
|
15
|
+
* Model loading nodes typically have longer execution times on first run
|
|
16
|
+
* due to loading large files from disk into memory.
|
|
17
|
+
*
|
|
18
|
+
* @param nodeType - The class_type of the node to check
|
|
19
|
+
* @returns true if the node is known to load models from disk
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* if (isModelLoadingNode("CheckpointLoaderSimple")) {
|
|
24
|
+
* console.log("This node will load a checkpoint - may take a while!");
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function isModelLoadingNode(nodeType: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a workflow contains any model loading nodes.
|
|
31
|
+
* Useful for determining if a workflow might have a slow cold start.
|
|
32
|
+
*
|
|
33
|
+
* @param workflow - The workflow JSON object
|
|
34
|
+
* @returns true if the workflow contains at least one model loading node
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const workflow = { ... };
|
|
39
|
+
* if (workflowContainsModelLoading(workflow)) {
|
|
40
|
+
* console.log("First execution may be slow due to model loading");
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function workflowContainsModelLoading(workflow: object): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Extract all model loading nodes from a workflow.
|
|
47
|
+
* Returns an array of node IDs and their types.
|
|
48
|
+
*
|
|
49
|
+
* @param workflow - The workflow JSON object
|
|
50
|
+
* @returns Array of objects containing nodeId and nodeType for each model loading node
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const modelNodes = getModelLoadingNodes(workflow);
|
|
55
|
+
* console.log(`Found ${modelNodes.length} model loading nodes:`);
|
|
56
|
+
* modelNodes.forEach(({ nodeId, nodeType }) => {
|
|
57
|
+
* console.log(` - ${nodeId}: ${nodeType}`);
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function getModelLoadingNodes(workflow: object): Array<{
|
|
62
|
+
nodeId: string;
|
|
63
|
+
nodeType: string;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Estimated cold start time multiplier for model loading nodes.
|
|
67
|
+
* These are rough estimates based on typical hardware (HDD vs SSD, VRAM, etc.).
|
|
68
|
+
*/
|
|
69
|
+
export declare const MODEL_LOADING_TIME_ESTIMATES: {
|
|
70
|
+
/** Checkpoint models (SD 1.5: ~2GB, SDXL: ~6GB, Flux: ~12GB+) */
|
|
71
|
+
readonly checkpoint: {
|
|
72
|
+
readonly hdd: 30000;
|
|
73
|
+
readonly ssd: 10000;
|
|
74
|
+
readonly nvme: 5000;
|
|
75
|
+
};
|
|
76
|
+
/** VAE models (~200-800MB) */
|
|
77
|
+
readonly vae: {
|
|
78
|
+
readonly hdd: 5000;
|
|
79
|
+
readonly ssd: 2000;
|
|
80
|
+
readonly nvme: 1000;
|
|
81
|
+
};
|
|
82
|
+
/** LoRA models (~50-200MB) */
|
|
83
|
+
readonly lora: {
|
|
84
|
+
readonly hdd: 3000;
|
|
85
|
+
readonly ssd: 1000;
|
|
86
|
+
readonly nvme: 500;
|
|
87
|
+
};
|
|
88
|
+
/** ControlNet models (~1-3GB) */
|
|
89
|
+
readonly controlnet: {
|
|
90
|
+
readonly hdd: 15000;
|
|
91
|
+
readonly ssd: 5000;
|
|
92
|
+
readonly nvme: 2500;
|
|
93
|
+
};
|
|
94
|
+
/** Other models (CLIP, upscale, etc.) */
|
|
95
|
+
readonly other: {
|
|
96
|
+
readonly hdd: 10000;
|
|
97
|
+
readonly ssd: 3000;
|
|
98
|
+
readonly nvme: 1500;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Storage type for estimating model loading times.
|
|
103
|
+
*/
|
|
104
|
+
export type StorageType = "hdd" | "ssd" | "nvme";
|
|
105
|
+
/**
|
|
106
|
+
* Estimate the model loading time for a node type.
|
|
107
|
+
* This is a rough estimate and actual times may vary significantly based on:
|
|
108
|
+
* - Storage type and speed
|
|
109
|
+
* - Model size
|
|
110
|
+
* - Available VRAM
|
|
111
|
+
* - System memory
|
|
112
|
+
* - CPU performance
|
|
113
|
+
*
|
|
114
|
+
* @param nodeType - The class_type of the node
|
|
115
|
+
* @param storageType - The type of storage (defaults to "ssd")
|
|
116
|
+
* @returns Estimated loading time in milliseconds, or 0 if not a model loading node
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const estimatedTime = estimateModelLoadingTime("CheckpointLoaderSimple", "nvme");
|
|
121
|
+
* console.log(`Estimated loading time: ${estimatedTime}ms`);
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export declare function estimateModelLoadingTime(nodeType: string, storageType?: StorageType): number;
|
|
125
|
+
/**
|
|
126
|
+
* Calculate the total estimated model loading time for a workflow.
|
|
127
|
+
* This assumes all models need to be loaded from disk (cold start).
|
|
128
|
+
* On subsequent runs, models may be cached in VRAM/RAM.
|
|
129
|
+
*
|
|
130
|
+
* @param workflow - The workflow JSON object
|
|
131
|
+
* @param storageType - The type of storage (defaults to "ssd")
|
|
132
|
+
* @returns Total estimated loading time in milliseconds
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* const totalTime = estimateWorkflowModelLoadingTime(workflow, "nvme");
|
|
137
|
+
* console.log(`Estimated cold start time: ${totalTime / 1000}s`);
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export declare function estimateWorkflowModelLoadingTime(workflow: object, storageType?: StorageType): number;
|
|
141
|
+
/**
|
|
142
|
+
* Determine if a timeout should be extended for first execution based on model loading.
|
|
143
|
+
* Returns a recommended timeout multiplier.
|
|
144
|
+
*
|
|
145
|
+
* @param workflow - The workflow JSON object
|
|
146
|
+
* @param hasExecutedBefore - Whether this workflow has been executed before on this client
|
|
147
|
+
* @returns Recommended timeout multiplier (1.0 = no change, 2.0 = double timeout, etc.)
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* const baseTimeout = 60000; // 1 minute
|
|
152
|
+
* const multiplier = getTimeoutMultiplierForModelLoading(workflow, false);
|
|
153
|
+
* const adjustedTimeout = baseTimeout * multiplier;
|
|
154
|
+
* console.log(`Using timeout: ${adjustedTimeout}ms (${multiplier}x base)`);
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export declare function getTimeoutMultiplierForModelLoading(workflow: object, hasExecutedBefore?: boolean): number;
|
|
158
|
+
//# sourceMappingURL=model-loading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-loading.d.ts","sourceRoot":"","sources":["../../src/utils/model-loading.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,kpBAgE3B,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAatE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAalG;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B;IACvC,iEAAiE;;;;;;IAMjE,8BAA8B;;;;;;IAM9B,8BAA8B;;;;;;IAM9B,iCAAiC;;;;;;IAMjC,yCAAyC;;;;;;CAMjC,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAE,WAAmB,GAAG,MAAM,CA6BnG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAE,WAAmB,GAAG,MAAM,CAS3G;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,MAAM,EAChB,iBAAiB,GAAE,OAAe,GACjC,MAAM,CAyBR"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model loading detection utilities.
|
|
3
|
+
*
|
|
4
|
+
* These utilities help identify when ComfyUI is loading models (a typically slow operation)
|
|
5
|
+
* vs. executing standard workflow nodes. This is useful for applying adaptive timeouts
|
|
6
|
+
* and providing better progress feedback to users.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* List of node types that typically load models from disk.
|
|
10
|
+
* These operations can be very slow on first execution (cold start).
|
|
11
|
+
*/
|
|
12
|
+
export const MODEL_LOADING_NODE_TYPES = [
|
|
13
|
+
// Checkpoint loaders
|
|
14
|
+
"CheckpointLoaderSimple",
|
|
15
|
+
"CheckpointLoader",
|
|
16
|
+
"unCLIPCheckpointLoader",
|
|
17
|
+
// VAE loaders
|
|
18
|
+
"VAELoader",
|
|
19
|
+
"VAEDecode",
|
|
20
|
+
// LoRA loaders
|
|
21
|
+
"LoraLoader",
|
|
22
|
+
"LoraLoaderModelOnly",
|
|
23
|
+
// ControlNet loaders
|
|
24
|
+
"ControlNetLoader",
|
|
25
|
+
"ControlNetApply",
|
|
26
|
+
"ControlNetApplyAdvanced",
|
|
27
|
+
// IP-Adapter loaders
|
|
28
|
+
"IPAdapterModelLoader",
|
|
29
|
+
"IPAdapterApply",
|
|
30
|
+
// CLIP loaders
|
|
31
|
+
"CLIPLoader",
|
|
32
|
+
"DualCLIPLoader",
|
|
33
|
+
"CLIPVisionLoader",
|
|
34
|
+
// UNET loaders
|
|
35
|
+
"UNETLoader",
|
|
36
|
+
// Diffusion model loaders
|
|
37
|
+
"DiffusersLoader",
|
|
38
|
+
// Style model loaders
|
|
39
|
+
"StyleModelLoader",
|
|
40
|
+
// Upscale model loaders
|
|
41
|
+
"UpscaleModelLoader",
|
|
42
|
+
// GLIGEN loaders
|
|
43
|
+
"GLIGENLoader",
|
|
44
|
+
// PhotoMaker loaders
|
|
45
|
+
"PhotoMakerLoader",
|
|
46
|
+
// InstantID loaders
|
|
47
|
+
"InstantIDModelLoader",
|
|
48
|
+
// AnimateDiff loaders
|
|
49
|
+
"AnimateDiffLoader",
|
|
50
|
+
"ADE_AnimateDiffLoaderGen1",
|
|
51
|
+
"ADE_AnimateDiffLoaderGen2",
|
|
52
|
+
// Flux loaders
|
|
53
|
+
"FluxCheckpointLoader",
|
|
54
|
+
// SD3 loaders
|
|
55
|
+
"SD3CheckpointLoader",
|
|
56
|
+
// Common custom node loaders
|
|
57
|
+
"comfy.sd1.CheckpointLoader",
|
|
58
|
+
"comfy.sd2.CheckpointLoader",
|
|
59
|
+
"comfy.sdxl.CheckpointLoader",
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* Check if a node type is a model loading node.
|
|
63
|
+
* Model loading nodes typically have longer execution times on first run
|
|
64
|
+
* due to loading large files from disk into memory.
|
|
65
|
+
*
|
|
66
|
+
* @param nodeType - The class_type of the node to check
|
|
67
|
+
* @returns true if the node is known to load models from disk
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* if (isModelLoadingNode("CheckpointLoaderSimple")) {
|
|
72
|
+
* console.log("This node will load a checkpoint - may take a while!");
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export function isModelLoadingNode(nodeType) {
|
|
77
|
+
return MODEL_LOADING_NODE_TYPES.includes(nodeType);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Check if a workflow contains any model loading nodes.
|
|
81
|
+
* Useful for determining if a workflow might have a slow cold start.
|
|
82
|
+
*
|
|
83
|
+
* @param workflow - The workflow JSON object
|
|
84
|
+
* @returns true if the workflow contains at least one model loading node
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const workflow = { ... };
|
|
89
|
+
* if (workflowContainsModelLoading(workflow)) {
|
|
90
|
+
* console.log("First execution may be slow due to model loading");
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export function workflowContainsModelLoading(workflow) {
|
|
95
|
+
const nodes = Object.values(workflow);
|
|
96
|
+
for (const node of nodes) {
|
|
97
|
+
if (typeof node === "object" && node !== null) {
|
|
98
|
+
const classType = node.class_type;
|
|
99
|
+
if (classType && isModelLoadingNode(classType)) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Extract all model loading nodes from a workflow.
|
|
108
|
+
* Returns an array of node IDs and their types.
|
|
109
|
+
*
|
|
110
|
+
* @param workflow - The workflow JSON object
|
|
111
|
+
* @returns Array of objects containing nodeId and nodeType for each model loading node
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const modelNodes = getModelLoadingNodes(workflow);
|
|
116
|
+
* console.log(`Found ${modelNodes.length} model loading nodes:`);
|
|
117
|
+
* modelNodes.forEach(({ nodeId, nodeType }) => {
|
|
118
|
+
* console.log(` - ${nodeId}: ${nodeType}`);
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export function getModelLoadingNodes(workflow) {
|
|
123
|
+
const modelNodes = [];
|
|
124
|
+
for (const [nodeId, node] of Object.entries(workflow)) {
|
|
125
|
+
if (typeof node === "object" && node !== null) {
|
|
126
|
+
const classType = node.class_type;
|
|
127
|
+
if (classType && isModelLoadingNode(classType)) {
|
|
128
|
+
modelNodes.push({ nodeId, nodeType: classType });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return modelNodes;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Estimated cold start time multiplier for model loading nodes.
|
|
136
|
+
* These are rough estimates based on typical hardware (HDD vs SSD, VRAM, etc.).
|
|
137
|
+
*/
|
|
138
|
+
export const MODEL_LOADING_TIME_ESTIMATES = {
|
|
139
|
+
/** Checkpoint models (SD 1.5: ~2GB, SDXL: ~6GB, Flux: ~12GB+) */
|
|
140
|
+
checkpoint: {
|
|
141
|
+
hdd: 30000, // 30 seconds on HDD
|
|
142
|
+
ssd: 10000, // 10 seconds on SSD
|
|
143
|
+
nvme: 5000, // 5 seconds on NVMe
|
|
144
|
+
},
|
|
145
|
+
/** VAE models (~200-800MB) */
|
|
146
|
+
vae: {
|
|
147
|
+
hdd: 5000, // 5 seconds on HDD
|
|
148
|
+
ssd: 2000, // 2 seconds on SSD
|
|
149
|
+
nvme: 1000, // 1 second on NVMe
|
|
150
|
+
},
|
|
151
|
+
/** LoRA models (~50-200MB) */
|
|
152
|
+
lora: {
|
|
153
|
+
hdd: 3000, // 3 seconds on HDD
|
|
154
|
+
ssd: 1000, // 1 second on SSD
|
|
155
|
+
nvme: 500, // 0.5 seconds on NVMe
|
|
156
|
+
},
|
|
157
|
+
/** ControlNet models (~1-3GB) */
|
|
158
|
+
controlnet: {
|
|
159
|
+
hdd: 15000, // 15 seconds on HDD
|
|
160
|
+
ssd: 5000, // 5 seconds on SSD
|
|
161
|
+
nvme: 2500, // 2.5 seconds on NVMe
|
|
162
|
+
},
|
|
163
|
+
/** Other models (CLIP, upscale, etc.) */
|
|
164
|
+
other: {
|
|
165
|
+
hdd: 10000, // 10 seconds on HDD
|
|
166
|
+
ssd: 3000, // 3 seconds on SSD
|
|
167
|
+
nvme: 1500, // 1.5 seconds on NVMe
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Estimate the model loading time for a node type.
|
|
172
|
+
* This is a rough estimate and actual times may vary significantly based on:
|
|
173
|
+
* - Storage type and speed
|
|
174
|
+
* - Model size
|
|
175
|
+
* - Available VRAM
|
|
176
|
+
* - System memory
|
|
177
|
+
* - CPU performance
|
|
178
|
+
*
|
|
179
|
+
* @param nodeType - The class_type of the node
|
|
180
|
+
* @param storageType - The type of storage (defaults to "ssd")
|
|
181
|
+
* @returns Estimated loading time in milliseconds, or 0 if not a model loading node
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* const estimatedTime = estimateModelLoadingTime("CheckpointLoaderSimple", "nvme");
|
|
186
|
+
* console.log(`Estimated loading time: ${estimatedTime}ms`);
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
export function estimateModelLoadingTime(nodeType, storageType = "ssd") {
|
|
190
|
+
if (!isModelLoadingNode(nodeType)) {
|
|
191
|
+
return 0;
|
|
192
|
+
}
|
|
193
|
+
const lower = nodeType.toLowerCase();
|
|
194
|
+
// Checkpoint loaders
|
|
195
|
+
if (lower.includes("checkpoint")) {
|
|
196
|
+
return MODEL_LOADING_TIME_ESTIMATES.checkpoint[storageType];
|
|
197
|
+
}
|
|
198
|
+
// VAE loaders
|
|
199
|
+
if (lower.includes("vae")) {
|
|
200
|
+
return MODEL_LOADING_TIME_ESTIMATES.vae[storageType];
|
|
201
|
+
}
|
|
202
|
+
// LoRA loaders
|
|
203
|
+
if (lower.includes("lora")) {
|
|
204
|
+
return MODEL_LOADING_TIME_ESTIMATES.lora[storageType];
|
|
205
|
+
}
|
|
206
|
+
// ControlNet loaders
|
|
207
|
+
if (lower.includes("controlnet")) {
|
|
208
|
+
return MODEL_LOADING_TIME_ESTIMATES.controlnet[storageType];
|
|
209
|
+
}
|
|
210
|
+
// Default to "other" category
|
|
211
|
+
return MODEL_LOADING_TIME_ESTIMATES.other[storageType];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Calculate the total estimated model loading time for a workflow.
|
|
215
|
+
* This assumes all models need to be loaded from disk (cold start).
|
|
216
|
+
* On subsequent runs, models may be cached in VRAM/RAM.
|
|
217
|
+
*
|
|
218
|
+
* @param workflow - The workflow JSON object
|
|
219
|
+
* @param storageType - The type of storage (defaults to "ssd")
|
|
220
|
+
* @returns Total estimated loading time in milliseconds
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```ts
|
|
224
|
+
* const totalTime = estimateWorkflowModelLoadingTime(workflow, "nvme");
|
|
225
|
+
* console.log(`Estimated cold start time: ${totalTime / 1000}s`);
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
export function estimateWorkflowModelLoadingTime(workflow, storageType = "ssd") {
|
|
229
|
+
const modelNodes = getModelLoadingNodes(workflow);
|
|
230
|
+
let totalTime = 0;
|
|
231
|
+
for (const { nodeType } of modelNodes) {
|
|
232
|
+
totalTime += estimateModelLoadingTime(nodeType, storageType);
|
|
233
|
+
}
|
|
234
|
+
return totalTime;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Determine if a timeout should be extended for first execution based on model loading.
|
|
238
|
+
* Returns a recommended timeout multiplier.
|
|
239
|
+
*
|
|
240
|
+
* @param workflow - The workflow JSON object
|
|
241
|
+
* @param hasExecutedBefore - Whether this workflow has been executed before on this client
|
|
242
|
+
* @returns Recommended timeout multiplier (1.0 = no change, 2.0 = double timeout, etc.)
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* const baseTimeout = 60000; // 1 minute
|
|
247
|
+
* const multiplier = getTimeoutMultiplierForModelLoading(workflow, false);
|
|
248
|
+
* const adjustedTimeout = baseTimeout * multiplier;
|
|
249
|
+
* console.log(`Using timeout: ${adjustedTimeout}ms (${multiplier}x base)`);
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
export function getTimeoutMultiplierForModelLoading(workflow, hasExecutedBefore = false) {
|
|
253
|
+
// If already executed, models are likely cached
|
|
254
|
+
if (hasExecutedBefore) {
|
|
255
|
+
return 1.0;
|
|
256
|
+
}
|
|
257
|
+
const modelNodes = getModelLoadingNodes(workflow);
|
|
258
|
+
// No model loading nodes
|
|
259
|
+
if (modelNodes.length === 0) {
|
|
260
|
+
return 1.0;
|
|
261
|
+
}
|
|
262
|
+
// 1-2 model nodes: 2x timeout
|
|
263
|
+
if (modelNodes.length <= 2) {
|
|
264
|
+
return 2.0;
|
|
265
|
+
}
|
|
266
|
+
// 3-4 model nodes: 3x timeout
|
|
267
|
+
if (modelNodes.length <= 4) {
|
|
268
|
+
return 3.0;
|
|
269
|
+
}
|
|
270
|
+
// 5+ model nodes: 4x timeout (very heavy workflow)
|
|
271
|
+
return 4.0;
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=model-loading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-loading.js","sourceRoot":"","sources":["../../src/utils/model-loading.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,qBAAqB;IACrB,wBAAwB;IACxB,kBAAkB;IAClB,wBAAwB;IAExB,cAAc;IACd,WAAW;IACX,WAAW;IAEX,eAAe;IACf,YAAY;IACZ,qBAAqB;IAErB,qBAAqB;IACrB,kBAAkB;IAClB,iBAAiB;IACjB,yBAAyB;IAEzB,qBAAqB;IACrB,sBAAsB;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AeG;AACH,MAAM,UAAU,mCAAmC,CACjD,QAAgB,EAChB,oBAA6B,KAAK;IAElC,gDAAgD;IAChD,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,UAAU,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAElD,yBAAyB;IACzB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,8BAA8B;IAC9B,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,8BAA8B;IAC9B,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,mDAAmD;IACnD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comfyui-node",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "ComfyUI Node.js Client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,12 +39,16 @@
|
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsc --project tsconfig.json",
|
|
41
41
|
"build:watch": "tsc --project tsconfig.json --watch",
|
|
42
|
-
"test": "bun test",
|
|
43
|
-
"test:
|
|
42
|
+
"test": "bun test --bail 10 ./test/*.spec.ts",
|
|
43
|
+
"test:unit": "bun test ./test/*.spec.ts",
|
|
44
|
+
"test:all": "bun test",
|
|
45
|
+
"test:integration": "bun test ./test/integration/",
|
|
46
|
+
"test:integration:simple": "bun test ./test/integration/reconnection-simple.example.spec.ts",
|
|
47
|
+
"test:integration:reconnection": "bun test ./test/integration/reconnection.integration.spec.ts",
|
|
44
48
|
"test:real": "cross-env COMFY_REAL=1 bun test ./test/real.integration.spec.ts",
|
|
45
49
|
"test:full": "cross-env COMFY_REAL=1 COMFY_FULL=1 bun test ./test/real.full.integration.spec.ts",
|
|
46
|
-
"coverage": "bun test --coverage",
|
|
47
|
-
"coverage:lcov": "bun test --coverage --coverage-reporter=lcov",
|
|
50
|
+
"coverage": "bun test --coverage ./test/*.spec.ts",
|
|
51
|
+
"coverage:lcov": "bun test --coverage --coverage-reporter=lcov ./test/*.spec.ts",
|
|
48
52
|
"coverage:enforce": "bun run coverage:lcov && bun run coverage:check",
|
|
49
53
|
"coverage:check": "bun scripts/coverage-check.ts",
|
|
50
54
|
"typecov": "type-coverage --detail --ignore-catch --at-least 0",
|