Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Originals O3: the Soul ID eval never measures a demo training as trained

Claude34172c2518c2
diff --git a/scripts/eval/README.md b/scripts/eval/README.md
index 83f72825..6c52b805 100644
--- a/scripts/eval/README.md
+++ b/scripts/eval/README.md
@@ -209,9 +209,14 @@ refuses to start. Copy the file to `local/soul-id.json`. In your copy, set `"con
when the person in the photos agreed: the runner then sends Fuobe the consent line with the training,
as the Train dialog does. A look (`"kind": "style"`) needs no consent. Then run it with
`--suite scripts/eval/local/soul-id.json`. To reuse a character you already trained, put its element
-id in `"element"` instead of training again. Each case trains its own family (a Soul ID runs on the
-models of the base it was trained on), so a full cloud run trains four times: about $1.70 + $1.70 +
-$1.50 + $6.00 for the characters and $3.39 for the look, priced before anything starts.
+id in `"element"` instead of training again. Each case trains its own element (a Soul ID runs on the
+models of the base it was trained on), so a full cloud run trains five times: about $1.70 + $1.70 +
+$1.50 + $6.00 for the four character cases (Soul Cinema trains Fuobe Soul's family again unless its
+`"element"` names the character case's element) and $3.39 for the look, priced before anything
+starts. A training the server would run as a demo (no fal.ai key or AI-Toolkit connected, or Demo
+mode On) is skipped with its case, so a "trained" result is always a trained LoRA. The look case runs
+the trained style as the board's own look (`"presetId": "own-style"`), as a trained moodboard does in
+the app.
## The case format
diff --git a/scripts/eval/cases/soul-id.json b/scripts/eval/cases/soul-id.json
index b44a426f..0523e074 100644
--- a/scripts/eval/cases/soul-id.json
+++ b/scripts/eval/cases/soul-id.json
@@ -25,6 +25,7 @@
},
"references": {
"description": "No training: the same element's photos as references on an edit model (open) or a partner model (cloud), the bar Soul ID has to clear",
+ "preset": false,
"models": { "open": ["oss-qwen-edit"], "cloud": ["nano-banana-pro"], "demo": ["oss-qwen-edit"] }
}
},
@@ -119,7 +120,9 @@
{
"id": "soul-id/look",
"title": "A moodboard trained as a look on Fuobe Soul",
+ "note": "The trained style is the look (own-style), as the app runs a trained moodboard: none of Soul's own look LoRAs under it.",
"models": { "open": ["fuobe-soul"], "cloud": ["fuobe-soul"], "demo": ["fuobe-soul"] },
+ "presetId": "own-style",
"metrics": ["style", "clip", "aesthetic"],
"train": {
"photos": "local/styles/default",
diff --git a/scripts/eval/lib/run.mjs b/scripts/eval/lib/run.mjs
index ce8b546e..a39510ed 100644
--- a/scripts/eval/lib/run.mjs
+++ b/scripts/eval/lib/run.mjs
@@ -18,7 +18,8 @@ import { appendJsonl, latestJobs, newRunId, readJson, readJsonl, runDir, writeJs
const TERMINAL = new Set(["succeeded", "failed", "canceled"]);
/** The cloud's spend cap when none is given (US$). The open engine and demo runs are free. */
export const DEFAULT_CLOUD_CAP = 5;
-const MAX_ELEMENT_PHOTOS = 20;
+/** An element holds up to 80 photos, Soul ID's most (src/lib/catalog/training.ts SOUL_ID_PHOTOS.max). */
+const MAX_ELEMENT_PHOTOS = 80;
const money = (n) => (n == null ? "unknown" : n === 0 ? "Free" : `$${n < 0.1 ? n.toFixed(4) : n.toFixed(2)}`);
const sum = (xs) => xs.reduce((a, b) => a + (b ?? 0), 0);
@@ -178,11 +179,13 @@ export async function runEval(opts, io) {
if (why) for (const x of jobs.filter((y) => y.caseId === j.caseId && !y.skip)) x.skip = why;
}
// What each training would cost (cloud): the server's price for its target. A Higgsfield target never runs
- // (Fuobe measures its own Originals), and one without a price can't sit under the spend cap.
+ // (Fuobe measures its own Originals), and one without a price can't sit under the spend cap. On either real engine,
+ // a training the server would run as a demo (no trainer or key connected) or can't start is skipped: its "trained"
+ // results would measure an element that was never trained.
const trainingUsd = new Map();
const savedElements = dir ? readJson(path.join(dir, "elements.json"), {}) : {};
// A training an earlier attempt started (and paid for) isn't priced again: the resume waits for it.
- const willTrain = trainCases.filter((j) => !j.skip && engine === "cloud" && !j.train.element && !["succeeded", "training"].includes(savedElements[j.caseId]?.status));
+ const willTrain = trainCases.filter((j) => !j.skip && engine !== "demo" && !j.train.element && !["succeeded", "training"].includes(savedElements[j.caseId]?.status));
if (willTrain.length) {
const targets = (await client.request("GET", "/api/elements/eval-price/trainings").catch(() => null))?.targets ?? [];
for (const j of willTrain) {
@@ -190,9 +193,11 @@ export async function runEval(opts, io) {
const usd = trainingPrice(t);
let why = null;
if (t?.provider === "higgsfield") why = `training target ${j.train.target} runs on Higgsfield's API: Fuobe's evaluation never uses it (train on fal or your GPU)`;
- else if (usd == null && !opts.allowUnpriced) why = `training on ${j.train.target} has no price${t ? ` (the server says “${t.price}”)` : ""}, so the spend cap can't cover it: --allow-unpriced runs it anyway`;
+ else if (t?.demo) why = `training on ${j.train.target} would run as a demo on that Fuobe (${facts.demoMode === "on" ? "Demo mode is On" : `no ${t.provider === "fal" ? "fal.ai key" : "AI-Toolkit"} connected`}), so nothing would be trained`;
+ else if (t?.blocker) why = `training on ${j.train.target} can't start there: ${t.blocker}`;
+ else if (engine === "cloud" && usd == null && !opts.allowUnpriced) why = `training on ${j.train.target} has no price${t ? ` (the server says “${t.price}”)` : ""}, so the spend cap can't cover it: --allow-unpriced runs it anyway`;
if (why) for (const x of jobs.filter((y) => y.caseId === j.caseId && !y.skip)) x.skip = why;
- else trainingUsd.set(j.caseId, usd ?? 0);
+ else if (engine === "cloud") trainingUsd.set(j.caseId, usd ?? 0);
}
}
@@ -503,6 +508,12 @@ async function prepareElement(client, job, ctx) {
ctx.log(`Training ${name} on ${t.target} with ${refs.length} photos`);
// A character trains only with the person's consent (Soul ID's consent line): the case said so (trainingProblem checked).
const tr = await client.request("POST", `/api/elements/${encodeURIComponent(el.id)}/trainings`, { json: { target: t.target, ...(kind === "character" && { consent: t.consent === true }) } });
+ // The server trains for real or not at all: a demo training (its trainer or key went missing since the plan) would
+ // make the "trained" results measure an untrained element.
+ if (tr.provider === "demo") {
+ writeJson(file, { ...saved, [job.caseId]: { ...record, demoTraining: tr.id, target: t.target, status: "failed", error: "ran as a demo (free: nothing was trained)" } });
+ throw new Error(`the server ran the training on ${t.target} as a demo (no trainer or key connected), so nothing was trained`);
+ }
// An earlier training of this case that failed was paid for too: its cost stays in the run's spend.
const earlierUsd = prev?.training ? (prev.costUsd ?? prev.estimateUsd ?? 0) + (prev.earlierUsd ?? 0) : prev?.earlierUsd;
const started = { ...record, training: tr.id, target: t.target, status: "training", startedAt: ctx.now(), estimateUsd: ctx.estimateUsd ?? null, ...(earlierUsd && { earlierUsd }) };
diff --git a/tests/eval-harness.test.ts b/tests/eval-harness.test.ts
index aeaccdb0..3b2a79b2 100644
--- a/tests/eval-harness.test.ts
+++ b/tests/eval-harness.test.ts
@@ -249,6 +249,8 @@ describe("the runner on the demo provider", () => {
// The look case makes a style element (no consent line), @mentioned on Fuobe Soul.
expect(elements["soul-id/look"]).toMatchObject({ status: "demo", photos: 2 });
expect(prompt("soul-id/look")).toContain(`@${elements["soul-id/look"].handle} a lighthouse`);
+ // The trained style is the look, as the app runs a trained moodboard: none of Soul's own look LoRAs under it.
+ expect((rows.find((x) => x.caseId === "soul-id/look")!.request as { presetId?: string }).presetId).toBe("own-style");
const look = getElement(elements["soul-id/look"].id);
expect(look?.kind).toBe("style");
});
@@ -756,6 +758,16 @@ describe("runEval as a library", () => {
expect(cloud.recipe.notes.join(" ")).toMatch(/Movie Wide Angle Z-image left out on the cloud: its civitai link needs a token/);
});
+ it("runs the soul-id look as the board's own look, but not on the references variant's edit models", () => {
+ type LookJob = { variant: string; request: { modelId: string; presetId?: string; params: { extra?: Record<string, unknown> } } };
+ const jobs = plan.expandJobs(cases.loadSuite("soul-id"), { engine: "cloud", cases: ["soul-id/look"], prompts: 1, variants: ["trained", "half-strength", "references"] }) as unknown as LookJob[];
+ const by = Object.fromEntries(jobs.map((j) => [j.variant, j.request]));
+ expect(by.trained).toMatchObject({ modelId: "fuobe-soul", presetId: "own-style" });
+ expect(by["half-strength"]).toMatchObject({ presetId: "own-style", params: { extra: { characterStrength: 0.5 } } });
+ expect(by.references.modelId).toBe("nano-banana-pro");
+ expect(by.references.presetId).toBeUndefined();
+ });
+
it("writes a HEX palette as the Color signature does, and sends the lock variant through the palette-lock route", async () => {
const { expandJobs } = plan;
const { palettePrompt } = await import("@/lib/catalog/palettes");
@@ -992,6 +1004,49 @@ describe("the cloud spend cap", () => {
const dry = (await runner.runEval({ suite, engine: "cloud", dryRun: true, root }, { client })) as { jobs: { case: string; skip?: string }[] };
expect(dry.jobs.find((j) => j.case === "t/noconsent")?.skip).toMatch(/training a character needs "consent": true/);
});
+
+ it("never measures a demo training as trained: skipped when the server says it would be one, stopped when it ran as one", async () => {
+ const suiteFile = path.join(dir, "train-demo.json");
+ const photos = path.join(process.cwd(), "scripts/eval/fixtures/character");
+ fs.writeFileSync(
+ suiteFile,
+ JSON.stringify({
+ suite: "train-demo",
+ title: "Demo trainings",
+ description: "x",
+ original: "fuobe-soul-id",
+ kind: "image",
+ targets: { cloud: { models: ["fuobe-soul"] } },
+ cases: [{ id: "t/person", title: "person", train: { photos, targets: { cloud: "fal-z-image" }, minPhotos: 3, consent: true }, prompts: [{ id: "p", text: "{character} in a cafe", seed: 1 }] }],
+ }),
+ );
+ const suite = cases.loadSuite(suiteFile);
+ // The server lists the target as a demo (no fal.ai key there): nothing is planned for it.
+ const demoTarget = cloudStub({ previewUsd: 0.01, actualUsd: 0.01, models: ["fuobe-soul"], trainingTargets: [{ id: "fal-z-image", provider: "fal", price: "≈ $1.70 (2,000 steps)", demo: true, blocker: null }] });
+ const dry = (await runner.runEval({ suite, engine: "cloud", dryRun: true, root }, { client: demoTarget.client })) as { trainingUsd?: number; jobs: { case: string; skip?: string }[] };
+ expect(dry.jobs[0].skip).toMatch(/would run as a demo on that Fuobe \(no fal\.ai key connected\), so nothing would be trained/);
+ expect(dry.trainingUsd).toBeUndefined();
+ // One that can't start at all says why.
+ const blocked = cloudStub({ previewUsd: 0.01, actualUsd: 0.01, models: ["fuobe-soul"], trainingTargets: [{ id: "fal-z-image", provider: "fal", price: "≈ $1.70 (2,000 steps)", demo: false, blocker: "Add a fal.ai key in Settings" }] });
+ const dry2 = (await runner.runEval({ suite, engine: "cloud", dryRun: true, root }, { client: blocked.client })) as { jobs: { skip?: string }[] };
+ expect(dry2.jobs[0].skip).toMatch(/can't start there: Add a fal\.ai key/);
+ // The key went missing between the plan and the training: the server ran a demo, so the case stops before any render.
+ const stub = cloudStub({ previewUsd: 0.01, actualUsd: 0.01, models: ["fuobe-soul"], trainingTargets: [{ id: "fal-z-image", provider: "fal", price: "≈ $1.70 (2,000 steps)", demo: false, blocker: null }] });
+ const base = stub.client.request.bind(stub.client);
+ const client = {
+ ...stub.client,
+ async request(method: string, p: string, opts: { json?: Record<string, unknown>; query?: Record<string, unknown> } = {}) {
+ if (p === "/api/elements" && method === "POST") return { id: "el1", handle: "Eval_1" };
+ if (p === "/api/elements/el1/trainings" && method === "POST") return { id: "tr-demo", provider: "demo", status: "running" };
+ return base(method, p, opts);
+ },
+ };
+ const r = (await runner.runEval({ suite, engine: "cloud", maxUsd: 10, root }, { client, sleep: async () => {} })) as { dir: string; run: { spentUsd: number }; rows: Row[] };
+ expect(stub.started).toEqual([]);
+ expect(r.rows.every((x) => x.status === "skipped" && /training didn't finish: the server ran the training on fal-z-image as a demo/.test(String(x.skip)))).toBe(true);
+ expect(r.run.spentUsd).toBe(0);
+ expect(JSON.parse(fs.readFileSync(path.join(r.dir, "elements.json"), "utf8"))["t/person"]).toMatchObject({ status: "failed", demoTraining: "tr-demo" });
+ });
});
describe("what a job measures", () => {