The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Model variants: pick the files a GPU runs, and write them into the graph
Adarshe565bfa1cae8
diff --git a/bin/lib/worker/config.mjs b/bin/lib/worker/config.mjsindex e3b98abc..34e90139 100644--- a/bin/lib/worker/config.mjs+++ b/bin/lib/worker/config.mjs@@ -8,8 +8,9 @@ import path from "node:path";* 2: it says which inputs it takes, makes every clip and sound again, and keeps its ComfyUI behind the guard. 3: it makes* every picture of a job ticket again from its pixels too, and may have a CPU slot. 4: it runs a job ticket made for* another catalog when its own composer makes the same graph from it (the ticket's graphSha), and gives it back otherwise.+ * 5: it composes a job ticket that names a model variant with that variant's files, as its own catalog defines them.*/-export const PROTOCOL = 4;+export const PROTOCOL = 5;/*** The protocol this worker says it speaks: PROTOCOL, or 2 when it can't make pictures again (no sharp in its checkout).diff --git a/bin/lib/worker/run.mjs b/bin/lib/worker/run.mjsindex 7e0243df..10ea6a58 100644--- a/bin/lib/worker/run.mjs+++ b/bin/lib/worker/run.mjs@@ -649,7 +649,7 @@ async function work(saved, deps, owner) {// Each workflow's lane, when its ceiling names lanes.if (ceiling?.lanes && !laneOf) laneOf = laneMap(index, deps.allLanes ?? (await import("./dist/lanes.mjs")).allLanes);const facts = composer.workerFactsFrom(await readPcAnswers(ownFetch, base));- const r = await composer.composeTicket({ ticket: t.ticket, generationId: t.generationId, inputs: t.inputs }, { catalog: workerCatalog(catalogDir), catalogVersion, ceiling, laneOf, facts });+ const r = await composer.composeTicket({ ticket: t.ticket, generationId: t.generationId, inputs: t.inputs }, { catalog: workerCatalog(catalogDir), catalogVersion, ceiling, laneOf, facts, index });if (r.ok) return { graph: r.graph, made: r.made };// A ticket for the studio's newer catalog whose graph this build makes otherwise: back in line at no cost, and the// update is asked for at once (the updater reads it in status.json).diff --git a/src/lib/gpu/model-variants.ts b/src/lib/gpu/model-variants.tsnew file mode 100644index 00000000..ef2d6ad9--- /dev/null+++ b/src/lib/gpu/model-variants.ts@@ -0,0 +1,123 @@+/**+ * Model variants: other files of the same models that a workflow may load in place of some of its own+ * (workflows/comfyui/model-variants.json, built into requirements.json by scripts/comfy/build-requirements.mjs). The best+ * file format depends on the card: int8 files run faster on a card with fast int8 and no fp8 hardware, fp8 and FP4 files+ * on a card that has it.+ *+ * A workflow's model slots are the loader inputs that read one of its own files ([class, input] of that file's loaders,+ * in its model folder). A choice fills each slot with a file: the workflow's own files, or a variant's. pickFiles takes+ * the choices and what a GPU has, and returns the one it runs; swapGraphFiles writes that choice into a graph.+ *+ * Pure: the server, the worker program (its job-ticket composer imports this file) and the tests share it.+ */+import type { FileKey, ModelVariant, RequirementIndex } from "./types";++/** A card generation as nvidia-smi gives it: its CUDA compute capability ("8.6", "12.0"). */+export const GPU_GEN = /^\d{1,2}\.\d{1,2}$/;++const genValue = (g: string): number => {+ const [major, minor] = g.split(".").map(Number);+ return major * 100 + minor;+};++/** Is this generation inside the range (both ends counted)? An unknown generation is inside none. */+export function genInside(gen: string | null | undefined, range: ModelVariant["gpuGen"]): boolean {+ if (!gen || !range || !GPU_GEN.test(gen)) return false;+ const g = genValue(gen);+ return g >= genValue(range.min) && g <= genValue(range.max);+}++/** One way to fill a workflow's model slots. */+export interface FileChoice {+ /** The variant's id; null for the workflow's own files. */+ variant: string | null;+ /** Each slot's own file → the file that fills it in its place. Empty for the workflow's own files. */+ swap: Record<FileKey, FileKey>;+ /** Every file this choice loads (the workflow's files, with the swapped ones in their place). */+ files: FileKey[];+ /** Its graphics memory need in GB. */+ vramGb: number;+ /** The card generations it suits. None: no card prefers it. */+ gpuGen?: ModelVariant["gpuGen"];+}++/** The choices of a workflow: its own files first, then each of its variants, in the catalog's order of preference. */+export function fileChoices(index: Pick<RequirementIndex, "workflows">, workflowId: string): FileChoice[] {+ const wf = index.workflows[workflowId];+ if (!wf) return [];+ const own: FileChoice = { variant: null, swap: {}, files: [...wf.files], vramGb: wf.vramGb };+ return [+ own,+ ...(wf.variants ?? []).map((v) => ({+ variant: v.id,+ swap: { ...v.files },+ files: wf.files.map((k) => v.files[k] ?? k),+ vramGb: v.vramGb ?? wf.vramGb,+ ...(v.gpuGen && { gpuGen: v.gpuGen }),+ })),+ ];+}++/** Does the workflow have variants? */+export const hasVariants = (index: Pick<RequirementIndex, "workflows">, workflowId: string): boolean => !!index.workflows[workflowId]?.variants?.length;++/** What a GPU has, as pickFiles reads it. */+export interface ChoiceDevice {+ /** Its card's generation (compute capability), when it is known. */+ gpuGen?: string | null;+ /** Has it this file (a worker: verified against its pin; a person's ComfyUI: there, as its check read it)? */+ has: (key: FileKey) => boolean;+ /** Its graphics memory: a choice that needs more is left out. Undefined: not checked here. */+ fits?: (vramGb: number) => boolean;+ /** False: the workflow's own files only (a GPU that can't take a variant). */+ variants: boolean;+}++/**+ * The choice a GPU runs, or null when it has the files of none: first a variant made for its card's generation that it+ * has every file of (in the order of preference), then the workflow's own files, then any other variant it has every file+ * of. A GPU whose generation is unknown gets the workflow's own files when it has them. With `variants` false, only the+ * workflow's own files count.+ */+export function pickFiles(choices: readonly FileChoice[], device: ChoiceDevice): FileChoice | null {+ const whole = (c: FileChoice) => c.files.every((k) => device.has(k)) && (!device.fits || device.fits(c.vramGb));+ const own = choices.find((c) => c.variant === null);+ const others = device.variants ? choices.filter((c) => c.variant !== null) : [];+ const forCard = others.filter((c) => genInside(device.gpuGen, c.gpuGen));+ for (const c of [...forCard, ...(own ? [own] : []), ...others.filter((c) => !forCard.includes(c))]) if (whole(c)) return c;+ return null;+}++/** The base name a file is read by in a graph, and the loader inputs ("Class\u0000input") that read it. */+type Slot = { from: string; to: string; loaders: Set<string> };++/**+ * A graph with a choice written into it: in each model slot (a loader input that reads one of the swapped files, by that+ * file's loaders in the index), the file that fills it in its place. Nothing else changes; a graph that loads none of+ * the swapped files comes back as it was. The graph given is never changed.+ */+export function swapGraphFiles<G extends Record<string, { class_type: string; inputs: Record<string, unknown> }>>(+ graph: G,+ swap: Readonly<Record<FileKey, FileKey>>,+ index: Pick<RequirementIndex, "files">,+): G {+ const slots: Slot[] = [];+ for (const [from, to] of Object.entries(swap) as [FileKey, FileKey][]) {+ const a = index.files[from];+ const b = index.files[to];+ if (!a || !b) throw new Error(`${!a ? from : to} isn't a file of the catalog`);+ slots.push({ from: a.file, to: b.file, loaders: new Set((a.loaders ?? []).map(([cls, input]) => `${cls}\u0000${input}`)) });+ }+ if (!slots.length) return graph;+ const out = {} as Record<string, { class_type: string; inputs: Record<string, unknown> }>;+ for (const [id, node] of Object.entries(graph)) {+ let inputs = node?.inputs;+ for (const [input, value] of Object.entries(node?.inputs ?? {})) {+ if (typeof value !== "string") continue;+ const s = slots.find((x) => x.from === value && x.loaders.has(`${node.class_type}\u0000${input}`));+ if (s) inputs = { ...inputs, [input]: s.to };+ }+ out[id] = inputs === node?.inputs ? node : { ...node, inputs };+ }+ return out as G;+}diff --git a/src/lib/gpu/readiness.ts b/src/lib/gpu/readiness.tsindex 45c30a6c..a65db1ce 100644--- a/src/lib/gpu/readiness.ts+++ b/src/lib/gpu/readiness.ts@@ -1,5 +1,6 @@import { compareVersions, formatBytes, nameKey, splitKey, vramGb } from "./requirements";import { knownProblemNeed, knownProblems } from "./known-problems";+import { fileChoices, pickFiles, type FileChoice } from "./model-variants";import { cardFits, GPU_NEED_TEXT, readCard, type GpuNeed } from "./rtx";import type { Badge, FileKey, GpuInventory, IndexFile, InventorySummary, Need, Readiness, RequirementIndex, ToolReadiness, ToolRef, VramFit } from "./types";@@ -190,12 +191,30 @@ function fileNeed(key: FileKey, f: IndexFile, kind: "model" | "model-replace", c};}+/**+ * The files a workflow runs with on this ComfyUI (src/lib/gpu/model-variants.ts): its own when they are all there (or+ * the check didn't read them), else a model variant's whose files are all there, else its own (what it needs then). So+ * nobody downloads a file of the same model in another format when one variant is already there.+ */+export function filesHere(id: string, inv: GpuInventory, idx: RequirementIndex): FileChoice | null {+ const choices = fileChoices(idx, id);+ if (choices.length < 2) return choices[0] ?? null;+ const there = (key: FileKey) => {+ const f = idx.files[key];+ const s = f ? filePresence(f, inv) : "unknown";+ return s === "present" || s === "unobservable" || s === "unknown";+ };+ return pickFiles(choices, { has: there, variants: true }) ?? choices[0];+}+/** SPEC §7.1, one workflow. */export function workflowReadiness(id: string, inv: GpuInventory, idx: RequirementIndex, ctx: ReadinessContext): WorkflowReadiness {const w = idx.workflows[id];const base: WorkflowReadiness = { state: "unknown", needs: [], have: [], vram: { needGb: 0, fit: "any" }, firstRun: [], unvalidated: false, unobservable: [] };if (!w || !inv.reachable) return base;- const out: WorkflowReadiness = { ...base, state: "ready", firstRun: w.firstRun, unvalidated: !w.validated, vram: vramFit(w.vramGb, inv) };+ // Its own files, or a model variant's that are all there.+ const files = filesHere(id, inv, idx) ?? { files: w.files, vramGb: w.vramGb };+ const out: WorkflowReadiness = { ...base, state: "ready", firstRun: w.firstRun, unvalidated: !w.validated, vram: vramFit(files.vramGb, inv) };if (w.isolated && ctx.computer) return { ...out, state: "unsupported", reason: "This one needs its own ComfyUI, so it can't run next to your other add-ons." };if (w.isolated && ctx.account) return { ...out, state: "unsupported", reason: "This one needs its own ComfyUI, so it can't run next to your other add-ons." };// The NVIDIA RTX Video nodes: only on an NVIDIA RTX card (frame generation: RTX 40 or later). A card the check can't@@ -245,7 +264,7 @@ export function workflowReadiness(id: string, inv: GpuInventory, idx: Requiremen}if (packNeeds.size) out.needs.push({ key: "restart", kind: "restart", label: "Restart ComfyUI", detail: "ComfyUI loads new add-ons when it starts." });// Files.- for (const key of w.files) {+ for (const key of files.files) {const f = idx.files[key];if (!f) continue;const s = filePresence(f, inv);diff --git a/src/lib/job-ticket.ts b/src/lib/job-ticket.tsindex 6f8236d8..5842e289 100644--- a/src/lib/job-ticket.ts+++ b/src/lib/job-ticket.ts@@ -80,6 +80,18 @@ export interface JobTicket {/** Set at the claim: how long the job may run, and go without progress. */runLimitMs?: number;stallMs?: number;+ /**+ * Set at the claim: the model variant this worker runs the workflow with (src/lib/gpu/model-variants.ts), its id and+ * files (the workflow's file → the file in its place). The worker composes the graph, then writes in the variant as its+ * own catalog defines it, which must be these same files.+ */+ variant?: TicketVariant;+}++/** A job ticket's model variant (JobTicket.variant). */+export interface TicketVariant {+ id: string;+ files: Record<string, string>;}/** Why a ticket can't be used: an older or newer catalog ("update-worker"), or settings outside their rules. */@@ -308,6 +320,26 @@ const FACTS = shape({export const WORKFLOW_ID = /^[a-z0-9][a-z0-9._-]{0,95}(\{n\}[a-z0-9._-]{0,32})?$/i;const OP = /^[a-z0-9][a-z0-9-]{0,47}$/;const OUTPUT_KINDS = ["image", "video", "audio", "text", "model3d", "frame", "file"];+/** A model variant's id, and a model file as "folder/file" (the catalog's names: no climbing out, no root or drive). */+const VARIANT_ID = /^[a-z0-9][a-z0-9-]{0,39}$/;+const MODEL_KEY = /^[A-Za-z0-9_.-]{1,64}\/[A-Za-z0-9_.+ ()/-]{1,200}$/;+const modelKeyOk = (k: string) => MODEL_KEY.test(k) && !k.split("/").some((part) => part === "" || part === "." || part === "..");++/** What is wrong with a ticket's model variant, or null: an id and a few files, each "folder/file" → "folder/file" of one folder. */+function variantProblem(v: unknown): string | null {+ if (!v || typeof v !== "object" || Array.isArray(v)) return "not a variant";+ const x = v as Record<string, unknown>;+ if (Object.keys(x).some((k) => k !== "id" && k !== "files")) return "an unknown field";+ if (typeof x.id !== "string" || !VARIANT_ID.test(x.id)) return "not a variant id";+ const files = x.files;+ if (!files || typeof files !== "object" || Array.isArray(files)) return "no files";+ const pairs = Object.entries(files as Record<string, unknown>);+ if (!pairs.length || pairs.length > 16) return "files out of range";+ for (const [from, to] of pairs) {+ if (typeof to !== "string" || !modelKeyOk(from) || !modelKeyOk(to)) return "a file isn't a model file";+ }+ return null;+}/*** Why a ticket can't be used, or null. `o.catalogVersion`: the reader's own (another one is "update-worker"); `o.known`:@@ -321,7 +353,7 @@ export function ticketProblem(const bad = (detail: string): TicketRefusal => ({ reason: "bad-ticket", detail });if (!t || typeof t !== "object" || Array.isArray(t)) return bad("not a ticket");const k = t as Partial<JobTicket> & Record<string, unknown>;- for (const key of Object.keys(k)) if (!["v", "workflowId", "catalogVersion", "op", "settings", "inputs", "outputs", "size", "loraSlot", "graphSha", "runLimitMs", "stallMs"].includes(key)) return bad(`${key} isn't part of a ticket`);+ for (const key of Object.keys(k)) if (!["v", "workflowId", "catalogVersion", "op", "settings", "inputs", "outputs", "size", "loraSlot", "graphSha", "runLimitMs", "stallMs", "variant"].includes(key)) return bad(`${key} isn't part of a ticket`);if (k.v !== TICKET_VERSION) return { reason: "update-worker", detail: "another ticket version" };if (typeof k.catalogVersion !== "string" || !SHA.test(k.catalogVersion)) return bad("no catalog version");if (k.graphSha !== undefined && (typeof k.graphSha !== "string" || !SHA.test(k.graphSha))) return bad("graphSha isn't a SHA-256");@@ -333,6 +365,7 @@ export function ticketProblem(if (typeof k.op !== "string" || !OP.test(k.op)) return bad("not an operation");if (k.loraSlot !== undefined && typeof k.loraSlot !== "boolean") return bad("loraSlot isn't true or false");for (const f of ["runLimitMs", "stallMs"] as const) if (k[f] !== undefined && num(0, 7 * 86_400_000, true)(k[f])) return bad(`${f} out of range`);+ if (k.variant !== undefined && variantProblem(k.variant)) return bad(`variant: ${variantProblem(k.variant)}`);const out = k.outputs as { count?: unknown; kind?: unknown } | undefined;if (!out || num(1, 256, true)(out.count) || typeof out.kind !== "string" || !OUTPUT_KINDS.includes(out.kind) || Object.keys(out).some((x) => x !== "count" && x !== "kind")) return bad("outputs out of range");const size = k.size as Partial<TicketSize> | undefined;diff --git a/src/lib/lanes.ts b/src/lib/lanes.tsindex 329a16e1..2894a52d 100644--- a/src/lib/lanes.ts+++ b/src/lib/lanes.ts@@ -89,15 +89,27 @@ export function allLanes(index: RequirementIndex, sha: Sha): { lane: string; labreturn [...by].map(([lane, workflows]) => ({ lane, label: laneLabel(index, lane, sha), workflows })).sort((a, b) => a.label.localeCompare(b.label));}+/** Index files as a task needs them (folder, name, exact size, sha256 when pinned). */+const fileNeeds = (index: RequirementIndex, keys: readonly string[]): FileNeed[] =>+ keys+ .map((k) => index.files[k as keyof RequirementIndex["files"]])+ .filter(Boolean)+ .map((f) => ({ folder: f.folder, name: f.file, size: f.sizeBytes, sha256: f.sha256 ?? null }));+/** What a workflow's task needs: its default files (folder, name, exact size, sha256 when pinned), packs and VRAM (with the tolerance). */export function needsOf(index: RequirementIndex, workflowId: string): Needs | null {const wf = index.workflows[workflowId];if (!wf) return null;- const files = wf.files- .map((k) => index.files[k])- .filter(Boolean)- .map((f) => ({ folder: f.folder, name: f.file, size: f.sizeBytes, sha256: f.sha256 ?? null }));- return { workflowId, files, packs: Object.keys(wf.packs).sort(), minVramBytes: minVramBytesFor(wf.vramGb) };+ return { workflowId, files: fileNeeds(index, wf.files), packs: Object.keys(wf.packs).sort(), minVramBytes: minVramBytesFor(wf.vramGb) };+}++/**+ * The files of each of a workflow's model variants (src/lib/gpu/model-variants.ts): its own files with the variant's in+ * their place, in the catalog's order of preference.+ */+export function variantNeeds(index: RequirementIndex, workflowId: string): { id: string; files: FileNeed[] }[] {+ const wf = index.workflows[workflowId];+ return (wf?.variants ?? []).map((v) => ({ id: v.id, files: fileNeeds(index, wf.files.map((k) => v.files[k] ?? k)) }));}/** The kinds of input file a worker may take. A worker makes every clip and sound again before its ComfyUI reads it. */@@ -160,8 +172,8 @@ export function hasFile(inv: Inventory, need: FileNeed): boolean {export const hasFiles = (inv: Inventory, needs: readonly FileNeed[] | undefined): boolean => !needs?.length || needs.every((n) => hasFile(inv, n));/**- * What a worker can run with what it has: the workflows whose files and packs are all there (and whose packs' node- * classes its ComfyUI loaded, where it said), the lanes whose every workflow runs, and, for the other lanes, what it lacks. A task goes only to a worker that can run its workflow.+ * What a worker can run with what it has: the workflows whose files (its own, or one of its variants') and packs are all+ * there (and whose packs' node classes its ComfyUI loaded, where it said), the lanes whose every workflow runs, and, for the other lanes, what it lacks. A task goes only to a worker that can run its workflow.*/export function lanesFor(index: RequirementIndex,@@ -177,7 +189,9 @@ export function lanesFor(if (index.workflows[id].isolated) continue;const lane = laneOf(index, id, sha)!;const n = needsOf(index, id)!;- const missingFiles = n.files.filter((f) => !hasFile(inv, f));+ // Its own files, or every file of one of its variants: a worker that has either may run it.+ let missingFiles = n.files.filter((f) => !hasFile(inv, f));+ if (missingFiles.length && variantNeeds(index, id).some((v) => hasFiles(inv, v.files))) missingFiles = [];const missingPacks = n.packs.filter((p) => !packs.has(p));const missingMedia = mediaOf(index.workflows[id]).filter((k) => !takes.has(k));const notLoaded = unloadedNodes(index.workflows[id], packs);diff --git a/src/lib/ticket-compose.ts b/src/lib/ticket-compose.tsindex 07144e0f..603f8a4c 100644--- a/src/lib/ticket-compose.ts+++ b/src/lib/ticket-compose.ts@@ -13,6 +13,8 @@ import { installedDbs, type DbsModel } from "./av/split";import type { GenInput, Operation } from "./catalog/types";import type { ComfyWorkflow } from "./comfy";import { ComposeError, composeWorkflow, withoutSaveMetadata, type ComposeCatalog, type ComposedSize, type ComposeRequest } from "./comfy-compose";+import { swapGraphFiles } from "./gpu/model-variants";+import type { RequirementIndex } from "./gpu/types";import { ceilingProblem, FILE_SETTINGS, ticketProblem, TICKET_VERSION, type Ceiling, type JobTicket, type TicketFacts, type TicketInput, type TicketInputKind } from "./job-ticket";import type { MediaInfo } from "./media-probe";@@ -186,10 +188,11 @@ export function graphFingerprint(graph: ComfyWorkflow, made: { data: Uint8Array* catalog and no facts of any PC, as a worker checks it (composeTicket). Null when the ticket doesn't compose.*/export async function ticketGraphSha(job: { ticket: JobTicket; generationId: string; inputs: { name: string; sha256: string }[] }, env: { catalog: ComposeCatalog; catalogVersion: string }): Promise<string | null> {- const { graphSha: _old, runLimitMs: _run, stallMs: _stall, ...ticket } = job.ticket;+ const { graphSha: _old, runLimitMs: _run, stallMs: _stall, variant: _variant, ...ticket } = job.ticket;void _old;void _run;void _stall;+ void _variant;const r = await composeOne({ ...job, ticket: { ...ticket, catalogVersion: env.catalogVersion } }, { catalog: env.catalog, catalogVersion: env.catalogVersion }, false).catch(() => null);return r?.ok ? graphFingerprint(r.graph, r.made) : null;}@@ -210,6 +213,31 @@ export const catalogKnows = (catalog: ComposeCatalog, id: string) => catalog.has* given back as they came out, for the studio to stage in place of the old ones, never checked against them.*/export async function composeTicket(job: TicketJob, env: ComposeEnv): Promise<TicketOutcome> {+ const r = await composeAsMade(job, env);+ return r.ok ? withVariant(r, job.ticket as Partial<JobTicket>, env) : r;+}++/**+ * A composed graph with the ticket's model variant written in (JobTicket.variant: src/lib/gpu/model-variants.ts), as this+ * build's own catalog defines that variant for the workflow: the same files, or the job goes back in line for an updated+ * worker. The graph's fingerprint is always checked before (composeAsMade): a variant is chosen per worker at the claim.+ */+function withVariant(r: Extract<TicketOutcome, { ok: true }>, t: Partial<JobTicket>, env: ComposeEnv): TicketOutcome {+ const v = t.variant;+ if (!v) return r;+ const changed = (detail: string): TicketOutcome => ({ ok: false, reason: "update-worker", detail, graphChanged: true });+ const own = env.index?.workflows[r.workflowId]?.variants?.find((x) => x.id === v.id);+ const same = !!own && Object.keys(own.files).length === Object.keys(v.files).length && Object.entries(own.files).every(([from, to]) => v.files[from] === to);+ if (!own || !same) return changed("the ticket's model variant isn't this build's");+ try {+ return { ...r, graph: swapGraphFiles(r.graph, own.files, env.index!) };+ } catch {+ return changed("the ticket's model variant names a file this build doesn't have");+ }+}++/** composeTicket before a model variant: the graph the studio's composer makes from the ticket. */+async function composeAsMade(job: TicketJob, env: ComposeEnv): Promise<TicketOutcome> {const t = job.ticket as Partial<JobTicket> | null;const other = !env.remake && !!t && typeof t === "object" && t.catalogVersion !== env.catalogVersion && typeof t.graphSha === "string" && /^[0-9a-f]{64}$/.test(t.graphSha);if (!other) return composeOne(job, env, false);@@ -227,7 +255,16 @@ export async function composeTicket(job: TicketJob, env: ComposeEnv): Promise<Ti}type TicketJob = { ticket: unknown; generationId: string; inputs: { name: string; sha256: string }[] };-type ComposeEnv = { catalog: ComposeCatalog; catalogVersion: string; ceiling?: Ceiling | null; laneOf?: (workflowId: string) => string | null; facts?: WorkerFacts; remake?: boolean };+type ComposeEnv = {+ catalog: ComposeCatalog;+ catalogVersion: string;+ ceiling?: Ceiling | null;+ laneOf?: (workflowId: string) => string | null;+ facts?: WorkerFacts;+ remake?: boolean;+ /** This build's requirement index: the model variants a ticket may name (none given: a ticket that names one is refused). */+ index?: Pick<RequirementIndex, "files" | "workflows">;+};async function composeOne(job: TicketJob, env: ComposeEnv, otherCatalog: boolean): Promise<TicketOutcome> {if (!GENERATION_ID.test(String(job.generationId))) return { ok: false, reason: "bad-ticket", detail: "not a run id" };diff --git a/src/server/gpu/files-here.ts b/src/server/gpu/files-here.tsnew file mode 100644index 00000000..324e87b0--- /dev/null+++ b/src/server/gpu/files-here.ts@@ -0,0 +1,22 @@+import "server-only";+import { hasVariants, swapGraphFiles } from "@/lib/gpu/model-variants";+import { filesHere } from "@/lib/gpu/readiness";+import type { RequirementIndex } from "@/lib/gpu/types";+import { loadIndex } from "./index-file";+import { readSnapshot } from "./snapshots";+import { runTarget } from "./target";++/**+ * A run on a ComfyUI the GPU check reads (a person's own GPU, or this install's own): the graph with a model variant's+ * files in its model slots when the check found that variant's files there and not the workflow's own (the same choice+ * the check's readiness makes: src/lib/gpu/readiness.ts filesHere). Otherwise, and with no check to read, the graph as+ * it was. Runs on the workers never come here: their files are chosen when a worker takes the job (pool.ts workerFiles).+ */+export function withFilesHere<G extends Record<string, { class_type: string; inputs: Record<string, unknown> }>>(graph: G, workflowId: string, index: RequirementIndex = loadIndex()): G {+ if (!hasVariants(index, workflowId)) return graph;+ const t = runTarget();+ const snap = t ? readSnapshot(t) : null;+ if (!snap?.inventory.reachable) return graph;+ const choice = filesHere(workflowId, snap.inventory, index);+ return choice?.variant ? swapGraphFiles(graph, choice.swap, index) : graph;+}diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.tsindex 5aa2597c..ada307fa 100644--- a/src/server/providers/comfyui.ts+++ b/src/server/providers/comfyui.ts@@ -54,6 +54,7 @@ import { hfPage } from "@/lib/gpu/plan";import { fileTitle } from "@/lib/gpu/readiness";import { formatBytes } from "@/lib/gpu/requirements";import type { FileKey } from "@/lib/gpu/types";+import { hasVariants } from "@/lib/gpu/model-variants";import { isEngineWords, plainEngineFailure } from "@/lib/engine-error";import {FILE_TROUBLE_WORDS,@@ -2062,7 +2063,13 @@ export const comfyProvider: ProviderAdapter = {// The pack switched off in Settings → Models & licences: Idol 3D runs its core graph, as without the pack.idolPack: async () => ((await import("@/server/model-access")).readAccess().packs.includes(IDOL_PACK) ? false : comfyHasClass(IDOL_PACK_CLASS, worker)),});- const { manifest, workflow: wf, meta } = prepared;+ const { manifest, workflow: composed, meta } = prepared;+ // On a ComfyUI the GPU check reads (not the workers', whose files are chosen when one takes the job): a model variant's+ // files when the check found them there and not the workflow's own (src/server/gpu/files-here.ts).+ let wf = composed;+ if (!onWorkers(computerScope()) && !onPoolWorkers() && hasVariants(loadIndex(), manifest.id)) {+ wf = await import("../gpu/files-here").then((m) => m.withFilesHere(composed, manifest.id)).catch(() => composed);+ }// MiniMax H3's 2K draft that kept its latent says where (the finish loads it only there: generations.ts latentHandOff).const latentAt = manifest.id === H3_LATENT_DRAFT_WORKFLOW ? comfyPlace() : null;if (latentAt) meta.latentAt = latentAt;diff --git a/tests/model-variants.test.ts b/tests/model-variants.test.tsnew file mode 100644index 00000000..a74d4e85--- /dev/null+++ b/tests/model-variants.test.ts@@ -0,0 +1,294 @@+import crypto from "node:crypto";+import fs from "node:fs";+import path from "node:path";+import { describe, expect, it, vi } from "vitest";+import { buildIndex, loadInputs } from "../scripts/comfy/build-requirements.mjs";+import { parseArgv } from "@/lib/gpu/argv";+import { emptyInventory } from "@/lib/gpu/gather";+import { fileChoices, genInside, hasVariants, pickFiles, swapGraphFiles, type FileChoice } from "@/lib/gpu/model-variants";+import { filesHere, workflowReadiness } from "@/lib/gpu/readiness";+import { parseIndex } from "@/lib/gpu/requirements";+import type { FileKey, GpuInventory, RequirementIndex } from "@/lib/gpu/types";+import { composeWorkflow, withoutSaveMetadata, type ComposeCatalog } from "@/lib/comfy-compose";+import { ticketProblem, type JobTicket } from "@/lib/job-ticket";+import { lanesFor, type Inventory } from "@/lib/lanes";+import { composeTicket, graphFingerprint, ticketFor } from "@/lib/ticket-compose";++/**+ * Model variants (workflows/comfyui/model-variants.json, src/lib/gpu/model-variants.ts): other files of the same models a+ * workflow may load in place of some of its own. The build refuses a variant that could load a file outside the catalog's+ * pins; a GPU runs a variant made for its card's generation when it has its files, its own files otherwise; the graph+ * gets the variant's files in its loader inputs only; a person's own GPU counts as ready with a variant's files.+ */++vi.setConfig({ testTimeout: 60_000 });++const ROOT = path.resolve(__dirname, "..");+const LIBRARY = path.join(ROOT, "workflows/comfyui");+const idx: RequirementIndex = parseIndex(JSON.parse(fs.readFileSync(path.join(LIBRARY, "requirements.json"), "utf8")));++const KREA = "krea2-turbo-t2i";+const FP8 = "diffusion_models/krea2_turbo_fp8_scaled.safetensors" as FileKey;+const INT8 = "diffusion_models/krea2_turbo_int8_convrot.safetensors" as FileKey;+const TE_FP8 = "text_encoders/qwen3vl_4b_fp8_scaled.safetensors" as FileKey;+const TE_INT8 = "text_encoders/qwen3vl_4b_int8_convrot.safetensors" as FileKey;+const VAE = "vae/qwen_image_vae.safetensors" as FileKey;++/** The committed inputs with model-variants.json replaced. */+const build = (variants: unknown[]) => buildIndex({ ...loadInputs(LIBRARY), variants: { variants } });+const variant = (o: Record<string, unknown> = {}) => ({ id: "int8", gpuGen: { min: "8.0", max: "8.6" }, workflows: [KREA], files: { [FP8]: INT8 }, ...o });++describe("the catalog's variants (build-requirements.mjs)", () => {+ it("puts each workflow's variants in requirements.json, in the order of model-variants.json", () => {+ expect(idx.workflows[KREA].variants).toEqual([{ id: "int8", files: { [FP8]: INT8, [TE_FP8]: TE_INT8 }, gpuGen: { min: "8.0", max: "8.6" } }]);+ // A Krea 2 workflow that already loads the int8 diffusion file swaps its text encoder only.+ expect(idx.workflows["style-ref-krea2"].variants).toEqual([{ id: "int8", files: { [TE_FP8]: TE_INT8 }, gpuGen: { min: "8.0", max: "8.6" } }]);+ expect(idx.workflows["ideogram4-t2i"].variants?.[0].files).toEqual({ "text_encoders/qwen3vl_8b_fp8_scaled.safetensors": "text_encoders/qwen3vl_8b_int8_convrot.safetensors" });+ for (const id of ["flux3-klein-t2i", "flux3-klein-edit", "flux3-klein-base-t2i-lora"]) expect(idx.workflows[id].variants?.map((v) => v.id), id).toEqual(["int8"]);+ // A workflow with none keeps no field.+ expect("variants" in idx.workflows["z-image-turbo-t2i"]).toBe(false);+ });++ it("swaps only to pinned catalog files, each in the same model folder, read by the same loader inputs", () => {+ const pins = loadInputs(LIBRARY).pins as Record<string, { sha256?: string; sizeBytes?: number }>;+ for (const [id, wf] of Object.entries(idx.workflows)) {+ for (const v of wf.variants ?? []) {+ for (const [from, to] of Object.entries(v.files) as [FileKey, FileKey][]) {+ const a = idx.files[from];+ const b = idx.files[to];+ expect(wf.files, `${id} ${v.id}`).toContain(from);+ expect(b.folder, `${id} ${v.id}`).toBe(a.folder);+ expect(pins[b.url]?.sha256 ?? b.sha256, `${to}`).toMatch(/^[0-9a-f]{64}$/);+ expect(pins[b.url]?.sizeBytes, `${to}`).toBe(b.sizeBytes);+ for (const l of a.loaders ?? []) expect(b.loaders?.map((x) => x.join(".")), `${to}`).toContain(l.join("."));+ }+ }+ }+ });++ it("refuses a variant whose new file has no pinned size and SHA-256", () => {+ const inputs = loadInputs(LIBRARY);+ const url = idx.files[INT8].url;+ const pins = { ...inputs.pins } as Record<string, { revision: string; sizeBytes: number; sha256?: string }>;+ pins[url] = { ...pins[url], sha256: undefined };+ expect(() => buildIndex({ ...inputs, pins, variants: { variants: [variant()] } })).toThrow(`${INT8} has no pinned size and SHA-256`);+ // No pin at all (its size is then only the manifest's guess).+ delete pins[url];+ expect(() => buildIndex({ ...inputs, pins, variants: { variants: [variant()] } })).toThrow(`${INT8} has no pinned size and SHA-256`);+ });++ it("refuses a file that isn't in the catalog, one in another model folder, and one the workflow doesn't load", () => {+ expect(() => build([variant({ files: { [FP8]: "diffusion_models/made_up_int8.safetensors" } })])).toThrow("diffusion_models/made_up_int8.safetensors isn't a file of the catalog");+ expect(() => build([variant({ files: { [FP8]: TE_INT8 } })])).toThrow(`${TE_INT8} is in another model folder than ${FP8}`);+ expect(() => build([variant({ workflows: ["style-ref-krea2"] })])).toThrow(`${FP8} isn't one of style-ref-krea2's files`);+ expect(() => build([variant({ workflows: ["no-such-workflow"] })])).toThrow("no-such-workflow isn't a workflow of the manifest");+ });++ it("refuses a file that the workflow's loader input reads in no catalog workflow", () => {+ // clip_l is read by DualCLIPLoader only: Krea 2's CLIPLoader.clip_name never loads it.+ expect(() => build([variant({ files: { [TE_FP8]: "text_encoders/clip_l.safetensors" } })])).toThrow("loads text_encoders/qwen3vl_4b_fp8_scaled.safetensors with CLIPLoader.clip_name, which reads text_encoders/clip_l.safetensors in no workflow of the catalog");+ });++ it("refuses a malformed entry: its id, its card generations, its VRAM, two of one name", () => {+ expect(() => build([variant({ id: "Int 8" })])).toThrow(/id must be lower case/);+ expect(() => build([variant({ gpuGen: { min: "8.6", max: "8.0" } })])).toThrow(/gpuGen must be/);+ expect(() => build([variant({ gpuGen: { min: "sm86", max: "8.6" } })])).toThrow(/gpuGen must be/);+ expect(() => build([variant({ vramGb: -2 })])).toThrow(/vramGb must be a number/);+ expect(() => build([variant({ files: {} })])).toThrow(/files must map/);+ expect(() => build([variant(), variant()])).toThrow(`${KREA} has two variants named int8`);+ // A good one builds, with its own VRAM and no card generation.+ const ok = build([variant({ gpuGen: undefined, vramGb: 12 })]);+ expect(ok.workflows[KREA].variants).toEqual([{ id: "int8", files: { [FP8]: INT8 }, vramGb: 12 }]);+ });+});++const own = (c: FileChoice | null) => c?.variant ?? "own";++describe("which files a GPU runs (pickFiles)", () => {+ const choices = fileChoices(idx, KREA);+ const files = (keys: string[]) => (k: FileKey) => keys.includes(k);+ const BOTH = [FP8, TE_FP8, INT8, TE_INT8, VAE];+ const BASE = [FP8, TE_FP8, VAE];+ const VARIANT = [INT8, TE_INT8, VAE];++ it("lists the workflow's own files first, then each variant with its files in place", () => {+ expect(choices.map((c) => c.variant)).toEqual([null, "int8"]);+ expect(choices[1].files.sort()).toEqual([INT8, TE_INT8, VAE].sort());+ expect(choices[1].vramGb).toBe(idx.workflows[KREA].vramGb);+ expect(hasVariants(idx, KREA)).toBe(true);+ expect(hasVariants(idx, "z-image-turbo-t2i")).toBe(false);+ expect(fileChoices(idx, "z-image-turbo-t2i").map((c) => c.variant)).toEqual([null]);+ });++ it("a card of the variant's generation runs the variant when it has its files; another card runs the workflow's own", () => {+ expect(own(pickFiles(choices, { gpuGen: "8.6", has: files(BOTH), variants: true }))).toBe("int8");+ expect(own(pickFiles(choices, { gpuGen: "8.0", has: files(BOTH), variants: true }))).toBe("int8");+ expect(own(pickFiles(choices, { gpuGen: "8.9", has: files(BOTH), variants: true }))).toBe("own");+ expect(own(pickFiles(choices, { gpuGen: "12.0", has: files(BOTH), variants: true }))).toBe("own");+ });++ it("falls back to whichever files it has: its own on the variant's card, the variant on another card", () => {+ expect(own(pickFiles(choices, { gpuGen: "8.6", has: files(BASE), variants: true }))).toBe("own");+ expect(own(pickFiles(choices, { gpuGen: "12.0", has: files(VARIANT), variants: true }))).toBe("int8");+ // An unknown card: its own files when it has them, else a variant it has.+ expect(own(pickFiles(choices, { gpuGen: null, has: files(BOTH), variants: true }))).toBe("own");+ expect(own(pickFiles(choices, { has: files(VARIANT), variants: true }))).toBe("int8");+ // Part of a variant's files is no variant.+ expect(pickFiles(choices, { gpuGen: "8.6", has: files([INT8, TE_FP8]), variants: true })).toBeNull();+ });++ it("a GPU that takes no variant gets the workflow's own files only", () => {+ expect(own(pickFiles(choices, { gpuGen: "8.6", has: files(BOTH), variants: false }))).toBe("own");+ expect(pickFiles(choices, { gpuGen: "8.6", has: files(VARIANT), variants: false })).toBeNull();+ });++ it("leaves out a choice that needs more VRAM than the card has", () => {+ const tight: FileChoice[] = [choices[0], { ...choices[1], vramGb: 40 }];+ expect(own(pickFiles(tight, { gpuGen: "8.6", has: files(BOTH), fits: (gb) => gb <= 24, variants: true }))).toBe("own");+ expect(pickFiles(tight, { gpuGen: "8.6", has: files(VARIANT), fits: (gb) => gb <= 24, variants: true })).toBeNull();+ });++ it("reads card generations as numbers", () => {+ expect(genInside("8.6", { min: "8.0", max: "8.6" })).toBe(true);+ expect(genInside("8.10", { min: "8.0", max: "8.6" })).toBe(false);+ expect(genInside("12.0", { min: "10.0", max: "12.1" })).toBe(true);+ expect(genInside(null, { min: "8.0", max: "8.6" })).toBe(false);+ expect(genInside("8.6", undefined)).toBe(false);+ });+});++describe("the graph with a variant's files (swapGraphFiles)", () => {+ const graph = JSON.parse(fs.readFileSync(path.join(LIBRARY, `${KREA}.json`), "utf8")) as Record<string, { class_type: string; inputs: Record<string, unknown> }>;+ const swap = idx.workflows[KREA].variants![0].files;++ it("writes the variant's files into the loader inputs only, and leaves the graph it was given as it was", () => {+ const before = JSON.stringify(graph);+ const withName = { ...graph, x: { class_type: "SaveImage", inputs: { filename_prefix: "krea2_turbo_fp8_scaled.safetensors" } } };+ const out = swapGraphFiles(withName, swap, idx);+ expect(out["10"].inputs.unet_name).toBe("krea2_turbo_int8_convrot.safetensors");+ expect(out["11"].inputs.clip_name).toBe("qwen3vl_4b_int8_convrot.safetensors");+ expect(out["12"]).toBe(withName["12"]);+ // A value that only looks like the file, outside a loader input, stays.+ expect(out.x.inputs.filename_prefix).toBe("krea2_turbo_fp8_scaled.safetensors");+ expect(JSON.stringify(graph)).toBe(before);+ expect(swapGraphFiles(graph, {}, idx)).toBe(graph);+ });++ it("refuses a swap that names a file the catalog doesn't have", () => {+ expect(() => swapGraphFiles(graph, { [FP8]: "diffusion_models/other.safetensors" as FileKey }, idx)).toThrow("isn't a file of the catalog");+ });+});++/** A worker's inventory with these files (verified: size and pin) and every pack and kind of input. */+function workerInventory(keys: FileKey[]): Inventory {+ return {+ files: keys.map((k) => ({ folder: idx.files[k].folder, name: idx.files[k].file, size: idx.files[k].sizeBytes, sha256: "a".repeat(64) })),+ nodePacks: Object.keys(idx.packs).map((name) => ({ name, commit: null })),+ media: ["image", "video", "audio"],+ };+}+const sha = (s: string) => crypto.createHash("sha256").update(s).digest("hex");++describe("what a worker can run (lanesFor)", () => {+ it("counts a workflow whose own files or one variant's files are all there", () => {+ expect(lanesFor(idx, workerInventory([FP8, TE_FP8, VAE]), sha).workflows).toContain(KREA);+ expect(lanesFor(idx, workerInventory([INT8, TE_INT8, VAE]), sha).workflows).toContain(KREA);+ const part = lanesFor(idx, workerInventory([INT8, TE_FP8, VAE]), sha);+ expect(part.workflows).not.toContain(KREA);+ // What it lacks is said in the workflow's own files.+ expect(part.missing.flatMap((m) => m.files)).toContain(FP8);+ });+});++/** A person's ComfyUI (as its GPU check reads it) with these files and every node class. */+function comfyWith(keys: FileKey[]): GpuInventory {+ const inv = emptyInventory("server", 1);+ inv.reachable = true;+ inv.comfy = { version: "0.42.1", os: "posix", embeddedPython: false, deployEnv: "local-git", flags: parseArgv(["main.py"]) };+ inv.devices = [{ name: "cuda:0 NVIDIA GeForce RTX 3080 : cudaMallocAsync", type: "cuda", index: 0, vramTotal: 24 * 2 ** 30, vramFree: 0 }];+ inv.manager = { api: "none" };+ inv.nodes = { have: [], missing: [], total: 0, readAt: 1, how: "object_info" };+ for (const folder of idx.folders) inv.models[folder] = { have: {}, total: 0 };+ for (const f of Object.values(idx.files)) for (const [cls, input] of f.loaders ?? []) inv.combos[`${cls}.${input}`] ??= [];+ for (const k of keys) {+ const f = idx.files[k];+ inv.models[f.folder].have[f.file] = f.sizeBytes;+ for (const [cls, input] of f.loaders ?? []) inv.combos[`${cls}.${input}`].push(f.file);+ }+ return inv;+}++describe("a person's own GPU (readiness)", () => {+ it("is ready with a variant's files, and asks for no file of the same model in another format", () => {+ const r = workflowReadiness(KREA, comfyWith([INT8, TE_INT8, VAE]), idx, { account: true });+ expect(r.state).toBe("ready");+ expect(r.needs).toEqual([]);+ expect(r.have.map((n) => n.file)).toEqual(expect.arrayContaining([INT8, TE_INT8, VAE]));+ expect(filesHere(KREA, comfyWith([INT8, TE_INT8, VAE]), idx)?.variant).toBe("int8");+ });++ it("runs its own files when they are there, and asks for them when neither set is whole", () => {+ expect(filesHere(KREA, comfyWith([FP8, TE_FP8, INT8, TE_INT8, VAE]), idx)?.variant).toBeNull();+ const r = workflowReadiness(KREA, comfyWith([INT8, VAE]), idx, { account: true });+ expect(r.needs.map((n) => n.file).sort()).toEqual([FP8, TE_FP8].sort());+ });+});++const { loadManifest, getWorkflow } = await import("@/server/providers/comfyui");+const { computeCatalogVersion } = await import("@/server/computer/catalog-version");++describe("a job ticket that names a variant", () => {+ const VERSION = computeCatalogVersion(ROOT)!;+ const catalog: ComposeCatalog = { has: (id) => loadManifest().workflows.some((w) => w.id === id), get: getWorkflow };+ const files = idx.workflows[KREA].variants![0].files;++ async function studio() {+ const input = { prompt: "A calm portrait in soft window light", seed: 7, numOutputs: 1 };+ const out = await composeWorkflow(KREA, input, { generationId: "variant-gen-1", op: "t2i", catalog, sent: [], accountOnInstall: true, made: async () => "none" });+ const ticket = ticketFor({ endpoint: KREA, op: "t2i", input, made: [] }, { catalogVersion: VERSION, sent: [], file: () => null, facts: () => undefined, outputs: { count: 1, kind: "image" }, size: out.size });+ return { graph: withoutSaveMetadata(out.workflow), ticket };+ }+ const compose = (ticket: JobTicket, o: { index?: RequirementIndex; version?: string } = {}) =>+ composeTicket({ ticket, generationId: "variant-gen-1", inputs: [] }, { catalog, catalogVersion: o.version ?? VERSION, ...(o.index && { index: o.index }) });++ it("composes the studio's graph, then writes in the variant's files as the worker's own catalog defines them", async () => {+ const s = await studio();+ expect(ticketProblem({ ...s.ticket, variant: { id: "int8", files } }, { catalogVersion: VERSION })).toBeNull();+ const r = await compose({ ...s.ticket, variant: { id: "int8", files } }, { index: idx });+ if (!r.ok) throw new Error(r.detail);+ expect(r.graph).toEqual(swapGraphFiles(s.graph, files, idx));+ expect(JSON.stringify(r.graph)).toContain("krea2_turbo_int8_convrot.safetensors");+ expect(JSON.stringify(r.graph)).not.toContain("krea2_turbo_fp8_scaled.safetensors");+ // Without a variant: the workflow's own files, as before.+ const plain = await compose(s.ticket, { index: idx });+ expect(plain.ok && plain.graph).toEqual(s.graph);+ });++ it("checks a ticket for another catalog against the graph before the variant", async () => {+ const s = await studio();+ const graphSha = graphFingerprint(s.graph, []);+ const r = await compose({ ...s.ticket, catalogVersion: "f".repeat(64), graphSha, variant: { id: "int8", files } }, { index: idx });+ expect(r.ok && JSON.stringify(r.graph)).toContain("krea2_turbo_int8_convrot.safetensors");+ });++ it("goes back in line for an updated worker when the build doesn't define the same variant", async () => {+ const s = await studio();+ const other = { ...s.ticket, variant: { id: "int8", files: { [FP8]: INT8 } } };+ expect(await compose(other, { index: idx })).toMatchObject({ ok: false, reason: "update-worker", graphChanged: true });+ expect(await compose({ ...s.ticket, variant: { id: "fp4", files } }, { index: idx })).toMatchObject({ ok: false, reason: "update-worker" });+ // A build that has no variants to read takes none.+ expect(await compose({ ...s.ticket, variant: { id: "int8", files } })).toMatchObject({ ok: false, reason: "update-worker" });+ });++ it("refuses a variant field that isn't one", async () => {+ const s = await studio();+ const bad = (variant: unknown) => ticketProblem({ ...s.ticket, variant } as JobTicket, { catalogVersion: VERSION })?.detail;+ expect(bad("int8")).toMatch(/^variant: /);+ expect(bad({ id: "int8", files: {}, extra: 1 })).toMatch(/unknown field/);+ expect(bad({ id: "INT 8", files })).toMatch(/not a variant id/);+ expect(bad({ id: "int8", files: {} })).toMatch(/files out of range/);+ expect(bad({ id: "int8", files: { [FP8]: "../../etc/passwd" } })).toMatch(/isn't a model file/);+ expect(bad({ id: "int8", files: { [FP8]: "diffusion_models/../../x.safetensors" } })).toMatch(/isn't a model file/);+ expect(bad({ id: "int8", files: { [FP8]: "C:/models/x.safetensors" } })).toMatch(/isn't a model file/);+ });+});