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: never through Higgsfield's API, and only the model a case names

Claude766e4e0db501
diff --git a/scripts/eval/README.md b/scripts/eval/README.md
index 3bc6562d..3a346986 100644
--- a/scripts/eval/README.md
+++ b/scripts/eval/README.md
@@ -52,6 +52,13 @@ harness measures what a user gets.
- `--engine open` / `cloud` refuse a server whose engine mode excludes them. A job that would come
back as demo media is skipped and says why: Demo mode is On, no ComfyUI is connected, or there is
no cloud key.
+- **Never Higgsfield.** Fuobe uses no Higgsfield API: a job whose route would go through Higgsfield's
+ API is skipped, not measured. A generation's preview names its route; a studio route's estimate
+ lists where its steps run. A studio route that doesn't say (an older Fuobe) is skipped when that
+ Fuobe has a Higgsfield key. Connect fal or Replicate and set **Settings → Cloud provider** to Auto,
+ fal or Replicate.
+- **The model it names.** A job the server would run on another model than the one the case names
+ (a studio's default maker, say) is skipped, since it wouldn't measure that model.
- On the open engine the harness also reads ComfyUI directly (`--comfy-url`, default `COMFYUI_URL`
or `http://127.0.0.1:8188`). It uses three read-only endpoints: `/system_stats` for memory,
`/history` for ComfyUI's own timings, and `/object_info/LoraLoader` to name the LoRAs ComfyUI
@@ -104,7 +111,7 @@ One JSON file per Original in `cases/`. Later Original packages add their own fi
| `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 |
-| `genjutsu` | Genjutsu move / swap / restyle | 3 (through `/api/genjutsu`) | `original`, `partner` | 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 |
| `speak` | talking portraits | 1 portrait + voice | `infinitetalk`, `s2v` | lipsync, temporal, identity |
@@ -153,6 +160,7 @@ scripts/eval/local/
characters/default/*.jpg # 10–30 photos of ONE consenting person (soul-id)
dop/start.png, dop/end.png # a start frame (a person on a bridge fits the prompts), an end frame for transitions
genjutsu/dance.mp4, character.png, style.png
+ genjutsu/street.mp4, object.png # street.mp4 at least 720 px on each side (Kling O3's edit, the cloud partner)
mixed-media/clip.mp4
shorts/clip.mp4, shorts/frame0.png
speak/portrait.png, speak/voice.wav
@@ -186,7 +194,8 @@ written from `lib/schema.mjs`.
"variants": {
"recipe": { "description": "The recipe as researched", "loras": "recipe" },
"half": { "description": "Half strength", "loras": "recipe", "loraScale": 0.5 },
- "mine": { "loras": [{ "file": "my-lora.safetensors", "url": "https://huggingface.co/…", "strength": 0.8, "trigger": "myword" }] }
+ "mine": { "loras": [{ "file": "my-lora.safetensors", "url": "https://huggingface.co/…", "strength": 0.8, "trigger": "myword" }] },
+ "partner": { "models": { "cloud": ["kling-2-5-turbo"] }, "engines": ["cloud"] } // engines: where the variant runs
},
"cases": [
{
@@ -208,6 +217,8 @@ Other case fields:
research.
- `presetId`: a catalog preset.
- `models` / `op`: per-case models, and the operation.
+- `variantModels`: a variant's models for this case (`{"partner": {"cloud": ["kling-o3"]}}`), over
+ the variant's own. Each Genjutsu mode names its own partner this way.
- `shots`: a film's shots. Continuity is measured across them.
- `train`: photos, a target per engine, `consent`, and `minPhotos`.
- `submit`: a studio route and its body, with `{{inputs.video}}`, `{{source:inputs.video}}`,
diff --git a/scripts/eval/cases/case.schema.json b/scripts/eval/cases/case.schema.json
index 5e8400a6..101c4735 100644
--- a/scripts/eval/cases/case.schema.json
+++ b/scripts/eval/cases/case.schema.json
@@ -671,6 +671,18 @@
},
"additionalProperties": false
},
+ "engines": {
+ "minItems": 1,
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "demo",
+ "open",
+ "cloud"
+ ]
+ }
+ },
"params": {
"type": "object",
"properties": {
@@ -814,6 +826,43 @@
},
"additionalProperties": false
},
+ "variantModels": {
+ "type": "object",
+ "propertyNames": {
+ "type": "string",
+ "pattern": "^[a-z0-9][a-z0-9-]*$"
+ },
+ "additionalProperties": {
+ "type": "object",
+ "properties": {
+ "demo": {
+ "minItems": 1,
+ "type": "array",
+ "items": {
+ "type": "string",
+ "minLength": 1
+ }
+ },
+ "open": {
+ "minItems": 1,
+ "type": "array",
+ "items": {
+ "type": "string",
+ "minLength": 1
+ }
+ },
+ "cloud": {
+ "minItems": 1,
+ "type": "array",
+ "items": {
+ "type": "string",
+ "minLength": 1
+ }
+ }
+ },
+ "additionalProperties": false
+ }
+ },
"op": {
"type": "string"
},
diff --git a/scripts/eval/cases/cinema.json b/scripts/eval/cases/cinema.json
index f080ef6f..4fc210a2 100644
--- a/scripts/eval/cases/cinema.json
+++ b/scripts/eval/cases/cinema.json
@@ -13,7 +13,7 @@
"defaults": { "seeds": [1001], "metrics": ["clip", "temporal", "continuity"], "timeoutSeconds": 3600 },
"variants": {
"original": { "description": "The Cinema Original (or today's open / hosted-open model)" },
- "partner": { "description": "Seedance 2.5 for reference", "models": { "cloud": ["seedance-2-5"] } }
+ "partner": { "description": "Seedance 2.5 for reference", "models": { "cloud": ["seedance-2-5"] }, "engines": ["cloud"] }
},
"cases": [
{
diff --git a/scripts/eval/cases/dop.json b/scripts/eval/cases/dop.json
index 9488d3e4..fcae9520 100644
--- a/scripts/eval/cases/dop.json
+++ b/scripts/eval/cases/dop.json
@@ -72,7 +72,10 @@
"cloud": [
"kling-2-5-turbo"
]
- }
+ },
+ "engines": [
+ "cloud"
+ ]
}
},
"cases": [
diff --git a/scripts/eval/cases/genjutsu.json b/scripts/eval/cases/genjutsu.json
index 6be495dd..ea04739e 100644
--- a/scripts/eval/cases/genjutsu.json
+++ b/scripts/eval/cases/genjutsu.json
@@ -2,7 +2,7 @@
"$schema": "./case.schema.json",
"suite": "genjutsu",
"title": "Fuobe Genjutsu · motion transfer, object swap, restyle",
- "description": "Runs the Genjutsu studio route (POST /api/genjutsu, priced by /api/genjutsu/estimate) on your reference clips and images in local/genjutsu/: dance.mp4 (a 4–10 s clip of one person moving), character.png (who should move like that, a consenting person or a drawn character), street.mp4 (a clip with an object to swap), object.png (what replaces it), style.png (a look image you own). The Originals (O5) come first in each model list; today's open models run until they exist. On the cloud there is no hosted-open Genjutsu before O5, so the cloud runs only the partner variant (Kling) for reference.",
+ "description": "Runs the Genjutsu studio route (POST /api/genjutsu, priced by /api/genjutsu/estimate) on your reference clips and images in local/genjutsu/: dance.mp4 (a 4–10 s clip of one person moving), character.png (who should move like that, a consenting person or a drawn character), street.mp4 (a clip with an object to swap), object.png (what replaces it), style.png (a look image you own). The Originals (O5) come first in each model list; today's open models run until they exist. On the cloud there is no hosted-open Genjutsu before O5, so the cloud runs only the partner variant for reference, with each mode's own partner model on fal: Kling 3.0 Motion Control (move), Kling O3 edit (swap) and Kling O3 4K edit (restyle). A job is skipped when the studio would pick another model than the one named, or run through Higgsfield's API.",
"original": ["fuobe-genjutsu-move", "fuobe-genjutsu-swap", "fuobe-genjutsu-restyle"],
"kind": "video",
"targets": {
@@ -14,8 +14,8 @@
"variants": {
"original": { "description": "The Original (or today's open model) as the studio runs it" },
"partner": {
- "description": "A partner model for reference: Kling 3.0 Motion Control, Kling O3 edit",
- "models": { "cloud": ["kling-motion-control", "kling-o3"] }
+ "description": "Each mode's partner model on fal, for reference (cases name it: Kling 3.0 Motion Control, Kling O3 edit, Kling O3 4K edit)",
+ "engines": ["cloud"]
}
},
"cases": [
@@ -24,6 +24,7 @@
"title": "Motion transfer: your character dances the clip",
"inputs": { "video": "local/genjutsu/dance.mp4", "images": ["local/genjutsu/character.png"] },
"demoInputs": { "video": "samples/demo-portrait.mp4", "images": ["fixtures/character/drawn-face-1.png"] },
+ "variantModels": { "partner": { "cloud": ["kling-motion-control"] } },
"prompts": [{ "id": "dance", "text": "the character performs the dance from the clip, same timing" }],
"references": "local/genjutsu/character.png",
"metrics": ["temporal", "identity", "clip"],
@@ -36,6 +37,7 @@
"id": "genjutsu/swap",
"title": "Object swap: replace the object in the clip",
"models": { "open": ["fuobe-genjutsu-swap", "oss-vace-swap"], "cloud": ["fuobe-genjutsu-swap"], "demo": ["oss-vace-swap"] },
+ "variantModels": { "partner": { "cloud": ["kling-o3"] } },
"inputs": { "video": "local/genjutsu/street.mp4", "images": ["local/genjutsu/object.png"] },
"demoInputs": { "video": "samples/demo-landscape.mp4", "images": ["fixtures/palette.png"] },
"prompts": [{ "id": "swap", "text": "the car on the left" }],
@@ -48,6 +50,7 @@
"id": "genjutsu/restyle",
"title": "Restyle: the clip in your look",
"models": { "open": ["fuobe-genjutsu-restyle", "oss-wan22-vace-restyle"], "cloud": ["fuobe-genjutsu-restyle"], "demo": ["oss-wan22-vace-restyle"] },
+ "variantModels": { "partner": { "cloud": ["kling-o3-4k-edit"] } },
"inputs": { "video": "local/genjutsu/dance.mp4", "images": ["local/genjutsu/style.png"] },
"demoInputs": { "video": "samples/demo-portrait.mp4", "images": ["fixtures/references/warm-1.png"] },
"prompts": [{ "id": "look", "text": "the same scene as a warm hand-painted animation" }],
diff --git a/scripts/eval/cases/mixed-media.json b/scripts/eval/cases/mixed-media.json
index 09b1ed9f..1ab71acf 100644
--- a/scripts/eval/cases/mixed-media.json
+++ b/scripts/eval/cases/mixed-media.json
@@ -2,12 +2,12 @@
"$schema": "./case.schema.json",
"suite": "mixed-media",
"title": "Fuobe Mixed Media · per-frame looks",
- "description": "Runs the Mixed Media studio route (POST /api/mixed-media) on your clip (local/mixed-media/clip.mp4, 4–10 s), the first three seconds at 8 fps, for five presets. Measures flicker (temporal drift and warp error) and how close each preset stays to its look (style references in local/references/mixed-media/<preset>/, optional). O9 moves the cloud route to hosted open models.",
+ "description": "Runs the Mixed Media studio route (POST /api/mixed-media) on your clip (local/mixed-media/clip.mp4, 4–10 s), the first three seconds at 8 fps, for five presets. Measures flicker (temporal drift and warp error) and how close each preset stays to its look (style references in local/references/mixed-media/<preset>/, optional). On the cloud it runs the studio's hosted open model (LTX-2.3 restyle on fal); O9 moves it to per-frame hosted open models.",
"original": "fuobe-mixed-media",
"kind": "video",
"targets": {
"open": { "models": ["oss-mixed-media"] },
- "cloud": { "models": ["oss-mixed-media"] },
+ "cloud": { "models": ["ltx-2-3-restyle"] },
"demo": { "models": ["oss-mixed-media"] }
},
"defaults": { "seeds": [1001], "metrics": ["temporal", "style"], "timeoutSeconds": 3600 },
@@ -19,7 +19,7 @@
"inputs": { "video": "local/mixed-media/clip.mp4" },
"demoInputs": { "video": "samples/demo-portrait.mp4" },
"references": "local/references/mixed-media/toxic",
- "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "presetId": "mixed-toxic", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
+ "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "modelId": "{{modelId}}", "presetId": "mixed-toxic", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
},
{
"id": "mixed-media/two-color",
@@ -27,7 +27,7 @@
"inputs": { "video": "local/mixed-media/clip.mp4" },
"demoInputs": { "video": "samples/demo-portrait.mp4" },
"references": "local/references/mixed-media/two-color",
- "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "presetId": "mixed-two-color", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
+ "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "modelId": "{{modelId}}", "presetId": "mixed-two-color", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
},
{
"id": "mixed-media/ultraviolet",
@@ -35,7 +35,7 @@
"inputs": { "video": "local/mixed-media/clip.mp4" },
"demoInputs": { "video": "samples/demo-portrait.mp4" },
"references": "local/references/mixed-media/ultraviolet",
- "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "presetId": "mixed-ultraviolet", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
+ "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "modelId": "{{modelId}}", "presetId": "mixed-ultraviolet", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
},
{
"id": "mixed-media/lava",
@@ -43,7 +43,7 @@
"inputs": { "video": "local/mixed-media/clip.mp4" },
"demoInputs": { "video": "samples/demo-portrait.mp4" },
"references": "local/references/mixed-media/lava",
- "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "presetId": "mixed-lava", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
+ "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "modelId": "{{modelId}}", "presetId": "mixed-lava", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
},
{
"id": "mixed-media/origami",
@@ -51,7 +51,7 @@
"inputs": { "video": "local/mixed-media/clip.mp4" },
"demoInputs": { "video": "samples/demo-portrait.mp4" },
"references": "local/references/mixed-media/origami",
- "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "presetId": "mixed-origami", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
+ "submit": { "route": "/api/mixed-media", "body": { "engine": "{{engine}}", "modelId": "{{modelId}}", "presetId": "mixed-origami", "source": "{{source:inputs.video}}", "range": { "start": 0, "end": 3 }, "fps": 8, "seed": "{{seed}}", "requestId": "{{requestId}}" } }
}
]
}
diff --git a/scripts/eval/gen-cases.mjs b/scripts/eval/gen-cases.mjs
index e73a1105..57fbde97 100644
--- a/scripts/eval/gen-cases.mjs
+++ b/scripts/eval/gen-cases.mjs
@@ -148,7 +148,7 @@ function dopSuite() {
catalog: { description: "The catalog preset as it ships (prompt template + today's LoRA map)" },
"prompt-only": { description: "The preset's prompt without LoRAs (preset strength 0)", presetStrength: 0 },
research: { description: "The research's LoRA map v2 at the listed strengths on the preset's prompt", presetStrength: 0, loras: "recipe" },
- partner: { description: "The preset's words on a partner model (Kling 2.5 Turbo), for reference", models: { cloud: ["kling-2-5-turbo"] } },
+ partner: { description: "The preset's words on a partner model (Kling 2.5 Turbo), for reference", models: { cloud: ["kling-2-5-turbo"] }, engines: ["cloud"] },
},
cases,
},
diff --git a/scripts/eval/lib/plan.mjs b/scripts/eval/lib/plan.mjs
index bc11c7b1..3207acd7 100644
--- a/scripts/eval/lib/plan.mjs
+++ b/scripts/eval/lib/plan.mjs
@@ -97,7 +97,8 @@ export function expandJobs(suite, opts) {
const metrics = kase.metrics ?? suite.defaults.metrics;
for (const variantName of variantNames) {
const variant = variantDefs[variantName];
- const candidates = opts.model ? [opts.model] : (forEngine(variant.models, engine) ?? forEngine(kase.models, engine) ?? target?.models ?? []);
+ // The models, most specific first: --model, this case's models for the variant, the variant's, the case's, the suite's.
+ const candidates = opts.model ? [opts.model] : (forEngine(kase.variantModels?.[variantName], engine) ?? forEngine(variant.models, engine) ?? forEngine(kase.models, engine) ?? target?.models ?? []);
const modelId = opts.available ? candidates.find((m) => opts.available.has(m)) : candidates[0];
for (const p of prompts) {
const seeds = p.seed !== undefined ? [p.seed] : (opts.seeds ?? suite.defaults.seeds);
@@ -106,7 +107,8 @@ export function expandJobs(suite, opts) {
/** @type {string | null} */
let skip = null;
if (kase.engines && !kase.engines.includes(engine)) skip = `runs on ${kase.engines.join(" / ")} only`;
- else if (!target && !variant.models && !kase.models) skip = `${suite.suite} has no ${engine} target`;
+ else if (variant.engines && !variant.engines.includes(engine)) skip = `the ${variantName} variant runs on ${variant.engines.join(" / ")} only`;
+ else if (!target && !variant.models && !kase.models && !kase.variantModels?.[variantName]) skip = `${suite.suite} has no ${engine} target`;
else if (!modelId) skip = `none of ${candidates.join(", ")} is on this Fuobe`;
else if (missing.length) skip = `missing local input${missing.length > 1 ? "s" : ""} ${missing.join(", ")} (see scripts/eval/README.md → Your own inputs)`;
if (usedFixtures && !demo) notes.push("ran on the synthetic fixtures (--allow-fixtures), not your own inputs");
diff --git a/scripts/eval/lib/run.mjs b/scripts/eval/lib/run.mjs
index fbb6c90a..49b4495b 100644
--- a/scripts/eval/lib/run.mjs
+++ b/scripts/eval/lib/run.mjs
@@ -74,6 +74,21 @@ export function lorasMissing(jobs, installed) {
return [...missing.values()];
}
+/** Why a job is refused: it would run through Higgsfield's API (Fuobe measures its own Originals and partners on fal / Replicate). */
+export const HIGGSFIELD_SKIP =
+ "would run on Higgsfield's API: the evaluation never uses it (connect fal or Replicate on that Fuobe, and set Settings → Cloud provider to Auto, fal or Replicate)";
+
+/**
+ * Whether a priced job would go through Higgsfield's API: a generation's route says so; a studio route's
+ * estimate lists its steps' providers. A studio route that doesn't (an older Fuobe) counts as Higgsfield
+ * when that Fuobe has a Higgsfield key, since its default makers may pick Higgsfield's own models.
+ */
+export function viaHiggsfield(preview, facts) {
+ if (preview.providerId === "higgsfield" || preview.route?.provider === "higgsfield") return true;
+ if (Array.isArray(preview.providers)) return preview.providers.includes("higgsfield");
+ return preview.studio ? !!facts.providers?.higgsfield : false;
+}
+
/** Run `fn` over `items` with at most `n` at a time, in order of start. */
async function pool(items, n, fn) {
let next = 0;
@@ -198,6 +213,9 @@ export async function runEval(opts, io) {
: `would run as a demo: ${p.modelName ?? job.model.id} has no ${engine === "open" ? "ComfyUI" : "cloud provider"} connected on that Fuobe`;
}
else if (engine !== "demo" && p.engine && p.engine !== engine) job.skip = `${p.modelName ?? job.model.id} is ${p.engine === "open" ? "an open-source" : "a cloud"} model, not ${engine}`;
+ else if (engine !== "demo" && viaHiggsfield(p, facts)) job.skip = HIGGSFIELD_SKIP;
+ // The server picks another model when it can't run the one asked for (a studio's default maker): that wouldn't measure it.
+ else if (p.modelId && p.modelId !== job.model.id) job.skip = `the server would run ${p.modelId} instead of ${job.model.id}, so this wouldn't measure ${job.model.id}`;
else if (engine === "cloud" && p.costUsd == null && !opts.allowUnpriced) job.skip = "the server can't price it, so the spend cap can't cover it: --allow-unpriced runs it anyway (it counts once its cost is known)";
else priced.push(job);
} catch (e) {
@@ -420,11 +438,12 @@ async function price(client, job, inputs, ctx) {
if (job.submit) {
const body = fillTemplate(job.submit.body, routeVars(job, inputs, ctx));
const route = job.submit.estimate === false ? null : (job.submit.estimate ?? `${job.submit.route}/estimate`);
- if (!route) return { costUsd: null, demo: ctx.engine === "demo", modelId: job.model.id };
+ if (!route) return { studio: true, costUsd: null, demo: ctx.engine === "demo", modelId: job.model.id };
const e = await client.request("POST", route, { json: body });
- return { costUsd: e.costUsd ?? e.totalUsd ?? null, demo: e.demo ?? ctx.engine === "demo", modelId: e.modelId ?? job.model.id, notes: e.notes };
+ return { studio: true, costUsd: e.costUsd ?? e.totalUsd ?? null, demo: e.demo ?? ctx.engine === "demo", modelId: e.modelId ?? job.model.id, ...(e.modelName && { modelName: e.modelName }), ...(Array.isArray(e.providers) && { providers: e.providers }), notes: e.notes };
}
- return client.request("POST", "/api/generations", { json: { ...job.request, inputs }, query: { preview: 1 } });
+ const p = await client.request("POST", "/api/generations", { json: { ...job.request, inputs }, query: { preview: 1 } });
+ return { ...p, ...(p.model?.id && { modelId: p.model.id, modelName: p.model.name }) };
}
/** Make (or reuse) the trained element a training case @mentions; returns {id, handle, training}. */
diff --git a/scripts/eval/lib/schema.mjs b/scripts/eval/lib/schema.mjs
index 1c501a1c..32cd15b5 100644
--- a/scripts/eval/lib/schema.mjs
+++ b/scripts/eval/lib/schema.mjs
@@ -110,8 +110,10 @@ const Variant = z
presetStrength: z.number().min(0).max(1).optional(),
/** The server's own Original applies the look: send the case's look id in this field and no client recipe. */
lookParam: z.enum(["presetId", "styleId"]).optional(),
- /** Other models for this variant (A/B a model against the recipe). */
+ /** Other models for this variant (A/B a model against the recipe). A case can name its own (variantModels). */
models: PerEngine(z.array(z.string().min(1)).min(1)).optional(),
+ /** The engines this variant runs on (a partner model is a cloud model: on the others it would repeat another variant). */
+ engines: z.array(z.enum(ENGINES)).min(1).optional(),
params: Params.optional(),
extra: Json.optional(),
})
@@ -160,6 +162,8 @@ export const CaseSchema = z
presetId: z.string().optional(),
/** Models for this case instead of the suite's targets (a look on another base, a mode with its own model). */
models: PerEngine(z.array(z.string().min(1)).min(1)).optional(),
+ /** A variant's models for this case, over the variant's own (each mode of a studio has its own partner model). */
+ variantModels: z.record(Slug, PerEngine(z.array(z.string().min(1)).min(1))).optional(),
op: z.string().optional(),
prompts: z.array(Prompt).min(1).optional(),
shots: z.array(Shot).min(1).max(24).optional(),
@@ -219,6 +223,9 @@ export const SuiteSchema = z
if (new Set(ids).size !== ids.length) ctx.addIssue({ code: "custom", path: ["cases", i, "prompts"], message: "prompt ids repeat" });
if (c.look && s.recipe !== "soul-look") ctx.addIssue({ code: "custom", path: ["cases", i, "look"], message: 'a look needs "recipe": "soul-look"' });
if (c.motion && s.recipe !== "motion") ctx.addIssue({ code: "custom", path: ["cases", i, "motion"], message: 'a motion needs "recipe": "motion"' });
+ for (const v of Object.keys(c.variantModels ?? {})) {
+ if (!s.variants?.[v]) ctx.addIssue({ code: "custom", path: ["cases", i, "variantModels", v], message: `no variant ${v} in this suite` });
+ }
});
const variants = Object.keys(s.variants ?? { default: {} });
if (s.defaults.variant && !variants.includes(s.defaults.variant)) {
diff --git a/src/server/genjutsu.ts b/src/server/genjutsu.ts
index 3c891c51..cf6e4f2c 100644
--- a/src/server/genjutsu.ts
+++ b/src/server/genjutsu.ts
@@ -302,9 +302,10 @@ function oneCall(input: GenjutsuPlanInput): string | undefined {
const unrunnable = (s: PlanStep) => !providersOf(s).some((id) => provider(id).isConfigured());
/** What the steps cost together (null when a price is unknown) and whether they would run as a demo. */
-function price(steps: PlanStep[], input: GenjutsuPlanInput): { costUsd: number | null; demo: boolean } {
+function price(steps: PlanStep[], input: GenjutsuPlanInput): { costUsd: number | null; demo: boolean; providers: ProviderId[] } {
let cost: number | null = 0;
const modes: StepMode[] = [];
+ const providers = new Set<ProviderId>();
let cannot = false;
for (const s of steps) {
let p: ReturnType<typeof previewChained>;
@@ -320,6 +321,7 @@ function price(steps: PlanStep[], input: GenjutsuPlanInput): { costUsd: number |
throw new ShortsError((e as Error).message, 422);
}
modes.push({ step: s, demo: p.demo });
+ providers.add(p.providerId);
// Genjutsu's tiers and Kling O3's edit price aren't in the catalog per resolution: the planner's table.
const own = p.demo ? null : makerStepUsd(s.request.modelId, s.request.params);
const usd = own ?? p.costUsd;
@@ -327,12 +329,14 @@ function price(steps: PlanStep[], input: GenjutsuPlanInput): { costUsd: number |
}
const problem = mixProblem(modes, cannot, input);
if (problem) throw new ShortsError(problem, 422);
- return { costUsd: cost === null ? null : Math.round(cost * 10000) / 10000, demo: modes.some((x) => x.demo) };
+ return { costUsd: cost === null ? null : Math.round(cost * 10000) / 10000, demo: modes.some((x) => x.demo), providers: [...providers] };
}
export interface GenjutsuEstimate {
costUsd: number | null;
demo: boolean;
+ /** Where the steps run ("mock" for demo steps): the evaluation harness refuses a route through Higgsfield's API. */
+ providers: ProviderId[];
/** The model that runs (the default, or the one picked) and its tier. */
modelId: string;
modelName: string;
diff --git a/src/server/mixed-media.ts b/src/server/mixed-media.ts
index 3d115eb1..87c55048 100644
--- a/src/server/mixed-media.ts
+++ b/src/server/mixed-media.ts
@@ -17,7 +17,7 @@ import {
} from "@/lib/catalog/mixed-media";
import { clipLengthProblem, type PlanStep } from "@/lib/catalog/shorts";
import { sourceSeconds, takesImage } from "@/lib/catalog/shorts-models";
-import type { Engine, Generation } from "@/lib/catalog/types";
+import type { Engine, Generation, ProviderId } from "@/lib/catalog/types";
import { createPipeline } from "./chains";
import { db } from "./db";
import { getGeneration, previewChained } from "./generations";
@@ -104,21 +104,26 @@ async function planInput(body: MixedBody, opts: { probe: boolean }): Promise<{ i
const withChain = (s: PlanStep) => ({ ...s.request, ...(s.chain ? { chain: s.chain } : {}) });
-function price(steps: PlanStep[]): { costUsd: number | null; demo: boolean } {
+function price(steps: PlanStep[]): { costUsd: number | null; demo: boolean; providers: ProviderId[] } {
let cost: number | null = 0;
let demo = false;
+ const providers = new Set<ProviderId>();
for (const s of steps) {
const p = previewChained(withChain(s), s.after?.length ?? 0);
demo ||= p.demo;
+ providers.add(p.providerId);
cost = cost === null || p.costUsd === null ? null : cost + p.costUsd;
}
- return { costUsd: cost === null ? null : Math.round(cost * 10000) / 10000, demo };
+ return { costUsd: cost === null ? null : Math.round(cost * 10000) / 10000, demo, providers: [...providers] };
}
export interface MixedEstimate {
costUsd: number | null;
previewUsd: number | null;
demo: boolean;
+ /** The model that restyles the clip, and where the steps run ("mock" for demo steps), for the evaluation harness. */
+ modelId: string;
+ providers: ProviderId[];
frames: number;
fps: number;
notes: string[];
@@ -128,7 +133,7 @@ export async function estimateMixed(body: MixedBody): Promise<MixedEstimate> {
const { input, frames, notes } = await planInput(body, { probe: false });
const full = price(planMixed(input).steps);
const preview = price([planMixedPreview({ ...input, frameUrl: body.frameUrl ?? "/api/files/placeholder.png" })]);
- return { ...full, previewUsd: preview.costUsd, frames, fps: input.fps, notes };
+ return { ...full, previewUsd: preview.costUsd, modelId: input.modelId, frames, fps: input.fps, notes };
}
function run(steps: PlanStep[]): { batchId: string; items: Generation[]; byKey: Record<string, Generation> } {
diff --git a/tests/eval-harness.test.ts b/tests/eval-harness.test.ts
index 835c4f47..56fea9d0 100644
--- a/tests/eval-harness.test.ts
+++ b/tests/eval-harness.test.ts
@@ -33,6 +33,7 @@ const elements = await import("@/app/api/elements/route");
const element = await import("@/app/api/elements/[id]/route");
const genjutsu = await import("@/app/api/genjutsu/route");
const genjutsuEstimate = await import("@/app/api/genjutsu/estimate/route");
+const mixedEstimate = await import("@/app/api/mixed-media/estimate/route");
// The harness is plain ESM JavaScript (it runs with node, no build step).
const evalCli = (await import("../scripts/eval/eval.mjs")) as { main: (argv: string[], io?: object) => Promise<number> };
@@ -65,6 +66,7 @@ const ROUTES: [string, RegExp, (req: Request, m: RegExpExecArray) => Promise<Res
["GET", /^\/api\/elements\/([^/]+)$/, (r, m) => element.GET(r, ctx({ id: m[1] }))],
["POST", /^\/api\/genjutsu$/, (r) => genjutsu.POST(r)],
["POST", /^\/api\/genjutsu\/estimate$/, (r) => genjutsuEstimate.POST(r)],
+ ["POST", /^\/api\/mixed-media\/estimate$/, (r) => mixedEstimate.POST(r)],
];
let server: http.Server;
@@ -225,6 +227,44 @@ describe("the runner on the demo provider", () => {
expect(String((row.request as { prompt: string }).prompt)).toContain(`@${el.handle} as a chef`);
});
+ it("never runs a job through Higgsfield's API, and runs each Genjutsu mode's own partner model", async () => {
+ type Plan = { jobs: { case: string; variant: string; model: string; skip?: string }[] };
+ const dry = async (args: string[]) => JSON.parse((await cli(["run", ...args, "--dry-run", "--json"])).stdout) as Plan;
+ setSetting("falKey", "fal-test-key");
+ setSetting("higgsfieldKey", "hf-id:hf-secret");
+ try {
+ // Cloud provider: Higgsfield. The hosted Z-Image route would go there, so the job is refused, not measured.
+ setSetting("cloudProvider", "higgsfield");
+ const soul = await dry(["--suite", "soul", "--engine", "cloud", "--looks", "v1-general", "--variants", "plain", "--prompts", "1"]);
+ expect(soul.jobs.map((j) => j.skip)).toEqual([expect.stringMatching(/would run on Higgsfield's API/)]);
+ // Genjutsu's studio route lists its steps' providers: Motion Control and O3 edit go to Higgsfield, the 4K edit is fal-only.
+ const gh = await dry(["--suite", "genjutsu", "--engine", "cloud", "--variants", "partner", "--allow-fixtures"]);
+ const by = (p: Plan) => Object.fromEntries(p.jobs.map((j) => [j.case, j]));
+ expect(by(gh)["genjutsu/move"].skip).toMatch(/Higgsfield's API/);
+ expect(by(gh)["genjutsu/restyle"]).toMatchObject({ model: "kling-o3-4k-edit" });
+ expect(by(gh)["genjutsu/restyle"].skip).toBeUndefined();
+ // On Auto with fal connected, each mode runs its own partner on fal, even with a Higgsfield key set (no Genjutsu Lite).
+ setSetting("cloudProvider", "auto");
+ const g = await dry(["--suite", "genjutsu", "--engine", "cloud", "--variants", "partner", "--allow-fixtures"]);
+ expect(g.jobs.map((j) => [j.case, j.model, j.skip ?? null])).toEqual([
+ ["genjutsu/move", "kling-motion-control", null],
+ // The fixture clip is 768×432: Kling O3's edit wants 720 px on each side (your street.mp4 must be that big).
+ ["genjutsu/swap", "kling-o3", expect.stringMatching(/at least 720 px on each side/)],
+ ["genjutsu/restyle", "kling-o3-4k-edit", null],
+ ]);
+ // Mixed Media names its hosted open model, so the studio runs that one (and says so).
+ const mm = await dry(["--suite", "mixed-media", "--engine", "cloud", "--cases", "mixed-media/toxic", "--allow-fixtures"]);
+ expect(mm.jobs.map((j) => [j.model, j.skip ?? null])).toEqual([["ltx-2-3-restyle", null]]);
+ // A partner variant is a cloud model: on the open engine it would only repeat the Original's run.
+ const open = await dry(["--suite", "genjutsu", "--engine", "open", "--variants", "partner", "--allow-fixtures"]);
+ expect(open.jobs.every((j) => j.skip === "the partner variant runs on cloud only")).toBe(true);
+ } finally {
+ setSetting("cloudProvider", "auto");
+ setSetting("higgsfieldKey", "");
+ setSetting("falKey", "");
+ }
+ });
+
it("refuses an engine the server can't run, and skips jobs that would run as a demo on a real engine", async () => {
const dry = await cli(["run", "--suite", "soul", "--engine", "cloud", "--looks", "v1-general", "--dry-run"]);
expect(dry.code, dry.stderr).toBe(0);
@@ -644,3 +684,33 @@ describe("the cloud spend cap", () => {
expect(runner.trainingPrice({ price: "Higgsfield balance" })).toBeNull();
});
});
+
+describe("what a job measures", () => {
+ /** A Fuobe whose Genjutsu estimate answers with `estimate`, and whose status says which providers are connected. */
+ const studioStub = (estimate: Record<string, unknown>, providers: Record<string, { configured: boolean }>) => ({
+ url: "http://stub.local",
+ async request(method: string, p: string) {
+ if (p === "/api/status") return { engineMode: "both", demoMode: "auto", cloudProvider: "auto", providers };
+ if (p === "/api/models") return { items: ["kling-motion-control", "kling-o3", "kling-o3-4k-edit"].map((id) => ({ id })) };
+ if (p === "/api/genjutsu/estimate") return estimate;
+ throw new Error(`stub: no ${method} ${p}`);
+ },
+ });
+ const plan = (client: object) =>
+ runner.runEval({ suite: cases.loadSuite("genjutsu"), engine: "cloud", variants: ["partner"], cases: ["genjutsu/move"], allowFixtures: true, dryRun: true, root: path.join(dir, "measure") }, { client }) as Promise<{ jobs: { skip?: string }[] }>;
+
+ it("skips a job the server would run on another model than the one named", async () => {
+ const swapped = await plan(studioStub({ costUsd: 1, demo: false, modelId: "genjutsu-lite-motion-transfer", providers: ["higgsfield"] }, { fal: { configured: true } }));
+ expect(swapped.jobs[0].skip).toMatch(/Higgsfield's API/);
+ const other = await plan(studioStub({ costUsd: 1, demo: false, modelId: "kling-o3", providers: ["fal"] }, { fal: { configured: true } }));
+ expect(other.jobs[0].skip).toBe("the server would run kling-o3 instead of kling-motion-control, so this wouldn't measure kling-motion-control");
+ const same = await plan(studioStub({ costUsd: 1, demo: false, modelId: "kling-motion-control", providers: ["fal"] }, { fal: { configured: true } }));
+ expect(same.jobs[0].skip).toBeUndefined();
+ });
+
+ it("refuses a studio route that doesn't say where its steps run when that Fuobe has a Higgsfield key", async () => {
+ const older = { costUsd: 1, demo: false, modelId: "kling-motion-control" };
+ expect((await plan(studioStub(older, { fal: { configured: true }, higgsfield: { configured: true } }))).jobs[0].skip).toMatch(/Higgsfield's API/);
+ expect((await plan(studioStub(older, { fal: { configured: true }, higgsfield: { configured: false } }))).jobs[0].skip).toBeUndefined();
+ });
+});