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.

Evaluation harness: DoP variants that differ, and words without a LoRA's trigger

Claude43dfd21b8c70
diff --git a/scripts/eval/README.md b/scripts/eval/README.md
index d0043256..515defb3 100644
--- a/scripts/eval/README.md
+++ b/scripts/eval/README.md
@@ -110,7 +110,7 @@ One JSON file per Original in `cases/`. Later Original packages add their own fi
| `selftest` | the harness itself | 5 small tools (trim, palette lock, join, frame, image) | — | temporal, clip |
| `soul` | Fuobe Soul, the 139 looks | 139 looks × 3 subjects, pinned seeds | `recipe`, `prompt-only`, `half-strength`, `plain`, `original` | clip, aesthetic, style |
| `soul-id` | character training | your photos → train → 8 scenes | `trained`, `original` | identity, clip, aesthetic |
-| `dop` | DoP motions and effects | the 70 the research gives a LoRA | `catalog`, `prompt-only`, `research`, `partner` | temporal, clip |
+| `dop` | DoP motions and effects | the 70 the research gives a LoRA | `catalog`, `prompt-only`, `research` (the candidate), `partner` (cloud) | temporal, clip |
| `genjutsu` | Genjutsu move / swap / restyle | 3 (through `/api/genjutsu`) | `original`, `partner` (cloud: each mode's own partner on fal) | temporal, clip |
| `mixed-media` | Mixed Media | 5 looks on one clip (through `/api/mixed-media`) | `studio` | temporal, style |
| `shorts` | Shorts restyle | 1 | `restyle` | temporal, style, clip |
@@ -133,6 +133,20 @@ Soul variants, all on the same subjects and seeds:
- **original**: the shipped `fuobe-soul` Original, which applies the look on the server. It is
skipped until that Original exists.
+DoP variants, on your start frame with two seeds:
+
+- **catalog**: the preset as it ships, with today's open LoRA if it has one.
+- **prompt-only**: preset strength 0, so the preset's words without its LoRAs. The server leaves the
+ LoRA's trigger word out too, since it means nothing without the LoRA.
+- **research**: the research's LoRA map at the listed strengths, its trigger words in front of the
+ words (`trigger, prompt`, as a Soul look's).
+- **partner**: the preset's words on Kling 2.5 Turbo (cloud only).
+
+A variant that would send the server the same request as an earlier variant of the same case, prompt
+and seed (model, route, final prompt, LoRAs, settings and inputs) is skipped and names the one it
+repeats. Most DoP presets have no open LoRA in today's catalog, so their prompt-only run would repeat
+the catalog run.
+
### Licence rules in the runs
The recipe's licence flags go with every job, following the research's "Licence rules for
diff --git a/scripts/eval/lib/plan.mjs b/scripts/eval/lib/plan.mjs
index 3207acd7..20d6b6e2 100644
--- a/scripts/eval/lib/plan.mjs
+++ b/scripts/eval/lib/plan.mjs
@@ -132,8 +132,9 @@ export function expandJobs(suite, opts) {
notes.push(...picked.notes);
// A variant that is about the recipe's LoRAs means nothing when none of them can run here.
if (!skip && variant.loras === "recipe" && picked.wanted && !loras.length) skip = `none of the recipe's LoRAs can run on ${engine === "cloud" ? "the cloud" : modelId}: ${picked.notes.join("; ")}`;
+ // Triggers lead, joined like a look's ("triggers, prompt": the research's template convention).
const triggers = triggersOf(loras);
- if (triggers) prompt = `${triggers} ${p.text}`.trim();
+ if (triggers) prompt = `${triggers}, ${p.text}`.trim();
} else if (variant.loras && variant.loras !== "recipe" && variant.loras !== "none") {
loras = lorasFor(null, variant, engine).loras;
}
diff --git a/scripts/eval/lib/run.mjs b/scripts/eval/lib/run.mjs
index 55e66ffc..6fd3eef5 100644
--- a/scripts/eval/lib/run.mjs
+++ b/scripts/eval/lib/run.mjs
@@ -197,7 +197,7 @@ export async function runEval(opts, io) {
}
// Price every runnable job with what the server says the route runs.
- const priced = [];
+ let priced = [];
for (const job of jobs) {
if (job.skip) continue;
try {
@@ -222,6 +222,17 @@ export async function runEval(opts, io) {
job.skip = `the server refused it: ${e.message}`;
}
}
+ // Two variants of one case, prompt and seed that would send the server the same thing (a catalog preset with no
+ // open LoRA is its own prompt-only run) run once: the later variant is skipped and names the one it repeats.
+ const firstOf = new Map();
+ for (const job of priced) {
+ const sig = requestSignature(job);
+ if (!sig) continue;
+ const first = firstOf.get(`${job.key}|${sig}`);
+ if (first) job.skip = `the same request as the ${first.variant} variant (same model, route, prompt, LoRAs and settings)`;
+ else firstOf.set(`${job.key}|${sig}`, job);
+ }
+ priced = priced.filter((j) => !j.skip);
const training = sum([...trainingUsd.entries()].filter(([caseId]) => jobs.some((x) => x.caseId === caseId && !x.skip)).map(([, usd]) => usd));
const estimate = sum(priced.map((j) => j.preview.costUsd)) + training;
const unknownCost = priced.filter((j) => j.preview.costUsd == null).length;
@@ -365,6 +376,17 @@ export async function runEval(opts, io) {
return { runId, dir, run, rows };
}
+/**
+ * What the server would run for a generation job, as one string: model, operation, route, its final prompt,
+ * the LoRAs it loads, the settings, the inputs. Null when the preview doesn't say (a studio route, an older Fuobe).
+ */
+function requestSignature(job) {
+ const p = job.preview;
+ if (job.submit || !p || typeof p.prompt !== "string" || !p.loras) return null;
+ const loras = (p.loras.applied ?? []).map((l) => [l.file, l.strength ?? 1, l.target ?? "both"]);
+ return JSON.stringify([p.modelId ?? job.model.id, p.op ?? null, p.route?.endpoint ?? null, p.prompt, loras, job.request.params ?? {}, job.request.negativePrompt ?? null, job.request.presetId ?? null, job.inputs]);
+}
+
/** What a job is, for its row (also written for jobs that never ran). */
function recordBase(job) {
return {
diff --git a/src/lib/catalog/plan.ts b/src/lib/catalog/plan.ts
index fcb6f34c..d3c41fb4 100644
--- a/src/lib/catalog/plan.ts
+++ b/src/lib/catalog/plan.ts
@@ -198,7 +198,16 @@ export function planGeneration(
if (req.loras?.length) loras = [...loras, ...req.loras];
// A LoRA at strength 0 changes nothing: leave it out, so preset strength 0 is the preset's prompt alone (and its file isn't needed).
- loras = loras.filter((l) => (l.strength ?? 1) !== 0);
+ const kept = loras.filter((l) => (l.strength ?? 1) !== 0);
+ // Its trigger word goes with it: an open motion's template starts with its LoRA's trigger ("e13c7r1c electricity
+ // effect. …", see withOssLoras), which means nothing to the model without the LoRA.
+ const keptTriggers = new Set(kept.map((l) => l.trigger).filter(Boolean));
+ for (const l of loras) {
+ if ((l.strength ?? 1) !== 0 || !l.trigger || keptTriggers.has(l.trigger)) continue;
+ const lead = [". ", ", ", " "].map((sep) => l.trigger + sep).find((t) => prompt.startsWith(t));
+ if (lead) prompt = prompt.slice(lead.length);
+ }
+ loras = kept;
// Multi-shot: the clip is as long as its shots, and models without per-shot prompts get them written out.
const shots = params.shots?.filter((s) => s.prompt.trim());
diff --git a/tests/eval-api.test.ts b/tests/eval-api.test.ts
index 57c14d0a..593b7295 100644
--- a/tests/eval-api.test.ts
+++ b/tests/eval-api.test.ts
@@ -79,15 +79,22 @@ describe("planGeneration with request LoRAs", () => {
expect(plan.loras.map((l) => l.file)).toEqual(["a.safetensors"]);
});
- it("preset strength 0 is the motion's prompt without its LoRAs (the harness's prompt-only baseline)", () => {
- const motion = getPreset("motion-dolly-in");
- expect(motion?.open?.loras?.length, "a motion with an open LoRA").toBeGreaterThan(0);
- const req = { feature: "eval", presetId: motion!.id, modelId: motion!.open!.modelId, prompt: "a cyclist on a coastal road", inputs: { images: ["start.png"] } };
- const full = planGeneration(req, getModel, getPreset);
- const none = planGeneration({ ...req, presetStrength: 0 }, getModel, getPreset);
- expect(full.loras.length).toBeGreaterThan(0);
- expect(none.loras).toEqual([]);
- expect(none.prompt).toBe(full.prompt);
+ it("preset strength 0 is the motion's prompt without its LoRAs or their trigger words (the harness's prompt-only baseline)", () => {
+ for (const id of ["motion-dolly-in", "effect-thunder-god"]) {
+ const motion = getPreset(id);
+ const trigger = motion?.open?.loras?.find((l) => l.trigger)?.trigger;
+ expect(trigger, `${id}: a preset with an open LoRA and a trigger`).toBeTruthy();
+ const req = { feature: "eval", presetId: motion!.id, modelId: motion!.open!.modelId, prompt: "a cyclist on a coastal road", inputs: { images: ["start.png"] } };
+ const full = planGeneration(req, getModel, getPreset);
+ const none = planGeneration({ ...req, presetStrength: 0 }, getModel, getPreset);
+ expect(full.loras.length).toBeGreaterThan(0);
+ expect(full.prompt.startsWith(`${trigger}. `)).toBe(true);
+ expect(none.loras).toEqual([]);
+ // The trigger means nothing without its LoRA: the rest of the preset's words stay.
+ expect(none.prompt).toBe(full.prompt.slice(trigger!.length + 2));
+ // Half strength keeps the LoRA, so its trigger stays too.
+ expect(planGeneration({ ...req, presetStrength: 0.5 }, getModel, getPreset).prompt).toBe(full.prompt);
+ }
});
});
diff --git a/tests/eval-harness.test.ts b/tests/eval-harness.test.ts
index 81470d5c..cdfd3132 100644
--- a/tests/eval-harness.test.ts
+++ b/tests/eval-harness.test.ts
@@ -610,13 +610,18 @@ describe("runEval as a library", () => {
it("expands, prices and lists a dry run without uploading anything", async () => {
const before = seen.filter((s) => s === "POST /api/uploads").length;
const suite = cases.loadSuite("dop");
- const plan = (await runner.runEval({ suite, engine: "demo", dryRun: true, limit: 2, variants: ["catalog", "prompt-only", "research"], root: results }, { client: createClient({ url: base }) })) as { jobs: { variant: string; loras?: { applied: string[] } }[]; runnable: number };
- expect(plan.runnable).toBe(12);
+ const plan = (await runner.runEval({ suite, engine: "demo", dryRun: true, cases: ["dop/motion-overhead", "dop/effect-thunder-god"], variants: ["catalog", "prompt-only", "research"], root: results }, { client: createClient({ url: base }) })) as { jobs: { case: string; variant: string; skip?: string; loras?: { applied: string[] } }[]; runnable: number };
expect(seen.filter((s) => s === "POST /api/uploads").length).toBe(before);
- const research = plan.jobs.find((j) => j.variant === "research")!;
- expect(research.loras?.applied.length).toBeGreaterThan(0);
- const promptOnly = plan.jobs.find((j) => j.variant === "prompt-only")!;
- expect(promptOnly.loras?.applied).toEqual([]);
+ const job = (c: string, v: string) => plan.jobs.find((j) => j.case === c && j.variant === v)!;
+ // Overhead has no LoRA in today's catalog: its prompt-only run would repeat the catalog run, so it's skipped.
+ expect(job("dop/motion-overhead", "catalog").loras?.applied).toEqual([]);
+ expect(job("dop/motion-overhead", "prompt-only").skip).toBe("the same request as the catalog variant (same model, route, prompt, LoRAs and settings)");
+ expect(job("dop/motion-overhead", "research").loras?.applied.length).toBeGreaterThan(0);
+ // Thunder God has one: catalog, prompt-only and research all run (2 seeds each).
+ expect(job("dop/effect-thunder-god", "catalog").loras?.applied).toEqual(["electrify_50_epochs.safetensors@1"]);
+ expect(job("dop/effect-thunder-god", "prompt-only").loras?.applied).toEqual([]);
+ expect(job("dop/effect-thunder-god", "prompt-only").skip).toBeUndefined();
+ expect(plan.runnable).toBe(10);
});
});