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.

Training kit: job specs, data-licence logs and the motion library for Fuobe's own LoRAs

Claude7492bf17cac7
diff --git a/.gitignore b/.gitignore
index c044a6f3..5c68416f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,6 @@ __pycache__/
# The worker's built parts (scripts/build-worker.mjs)
/bin/lib/worker/dist/
+
+# The training kit's job configs (scripts/train/kit.mjs job)
+/.train/
diff --git a/docs/research/fuobe-originals-recipes-5.json b/docs/research/fuobe-originals-recipes-5.json
index 544fea39..932f825b 100644
--- a/docs/research/fuobe-originals-recipes-5.json
+++ b/docs/research/fuobe-originals-recipes-5.json
@@ -16472,7 +16472,9 @@
"data": "80-150 editorial and street photos Fuobe owns or licensed with AI-training rights; varied skin tones, ages, light; captions written in Z-Image style (long sentences)",
"trainer": "fal-ai/z-image-trainer training_type=style (Z-Image base, $2.26 per 1,000 steps), or AI-Toolkit on Z-Image base / Turbo + ostris training adapter v2",
"steps": "2,000-3,000, rank 32, lr 1e-4",
- "use": "strength 0.5-0.7"
+ "use": "strength 0.5-0.7",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-cctv",
@@ -16482,7 +16484,9 @@
"data": "40-80 frames from cameras Fuobe controls (own CCTV, staged scenes); no overlays in the frames",
"trainer": "fal-ai/z-image-turbo-trainer-v2 ($0.85 per 1,000 steps) or AI-Toolkit",
"steps": "1,500-2,000",
- "use": "strength 0.8; overlay text in post"
+ "use": "strength 0.8; overlay text in post",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-ultrawide-05",
@@ -16492,7 +16496,9 @@
"data": "60+ selfies and outfit shots taken by the team with phone 0.5x lenses",
"trainer": "fal-ai/z-image-turbo-trainer-v2 or AI-Toolkit",
"steps": "1,500-2,000",
- "use": "strength 0.7"
+ "use": "strength 0.7",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-scale-surreal",
@@ -16502,7 +16508,9 @@
"data": "40-60 composites (giant props, tiny worlds) made by Fuobe from own photos",
"trainer": "fal-ai/z-image-trainer training_type=content",
"steps": "2,000",
- "use": "strength 0.7-0.9"
+ "use": "strength 0.7-0.9",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-through-glass",
@@ -16512,7 +16520,9 @@
"data": "40+ photos shot through fogged, reeded and rain-streaked glass",
"trainer": "fal-ai/z-image-turbo-trainer-v2",
"steps": "1,500",
- "use": "strength 0.8"
+ "use": "strength 0.8",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-old-phone",
@@ -16522,7 +16532,9 @@
"data": "60+ photos taken on real 2005-2012 camera phones",
"trainer": "fal-ai/z-image-turbo-trainer-v2",
"steps": "1,500",
- "use": "strength 0.8"
+ "use": "strength 0.8",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-frutiger-aero",
@@ -16532,7 +16544,9 @@
"data": "40-60 renders Fuobe makes (Blender, own designs)",
"trainer": "fal-ai/z-image-trainer training_type=style",
"steps": "2,000",
- "use": "strength 0.8"
+ "use": "strength 0.8",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-underwater",
@@ -16542,7 +16556,9 @@
"data": "40+ licensed underwater portraits",
"trainer": "fal-ai/z-image-turbo-trainer-v2",
"steps": "1,500",
- "use": "strength 0.8"
+ "use": "strength 0.8",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-paper-collage",
@@ -16552,7 +16568,9 @@
"data": "50+ physical paper collages photographed by Fuobe",
"trainer": "fal-ai/z-image-trainer training_type=style",
"steps": "2,000",
- "use": "strength 0.8"
+ "use": "strength 0.8",
+ "group": "look",
+ "status": "planned"
},
{
"id": "fuobe-beauty-details",
@@ -16562,7 +16580,48 @@
"data": "one small set per concept (20-40 images each), own or licensed",
"trainer": "fal-ai/z-image-turbo-trainer-v2, one LoRA per concept",
"steps": "1,000-1,500 each",
- "use": "strength 0.7"
+ "use": "strength 0.7",
+ "group": "look",
+ "status": "planned"
+ },
+ {
+ "id": "fuobe-push-in",
+ "kind": "motion",
+ "base": "wan2.2-i2v-a14b",
+ "group": "motion",
+ "presets": "Eyes In, Mouth In, Eating Zoom",
+ "data": "20-40 own-shot push-in clips (2-5 s, 16 fps): a steady dolly or zoom into the eyes or the mouth of people who signed a consent form; no text or logos in frame",
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b, or AI-Toolkit (wan22_14b_i2v)",
+ "steps": "400-1,000",
+ "use": "strength 1.0 on both experts",
+ "status": "planned",
+ "notes": "Replaces the Wan 'eyes in' LoRA (civitai 1877142), which forbids selling outputs. Added 2026-11-02 (o/o12-training-kit)."
+ },
+ {
+ "id": "fuobe-timelapse",
+ "kind": "motion",
+ "base": "wan2.2-i2v-a14b",
+ "group": "motion",
+ "presets": "Timelapse, Timelapse Human, Timelapse Landscape, Timelapse Glam, Hyperlapse",
+ "data": "30-60 own time-lapse and hyperlapse clips (skies, streets, people holding still while the world moves), 3-5 s each at 16 fps",
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b, or AI-Toolkit (wan22_14b_i2v)",
+ "steps": "600-1,000",
+ "use": "strength 1.0 on both experts",
+ "status": "planned",
+ "notes": "Replaces the Wan 2.2 Time-lapse LoRA (civitai 1877924), which forbids selling outputs. Added 2026-11-02 (o/o12-training-kit)."
+ },
+ {
+ "id": "fuobe-drone-reveal",
+ "kind": "motion",
+ "base": "wan2.2-i2v-a14b",
+ "group": "motion",
+ "presets": "Drone Reveal, Helicopter Shot, Flying",
+ "data": "30-60 own drone clips: a rising or forward reveal over a landscape or a building, flown by the team where flying is allowed; no people who did not consent",
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b, or AI-Toolkit (wan22_14b_i2v)",
+ "steps": "600-1,000",
+ "use": "strength 1.0 on both experts",
+ "status": "planned",
+ "notes": "DroneShot and Set Reveal forbid selling outputs. Added 2026-11-02 (o/o12-training-kit)."
}
],
"motionsEffects": [
@@ -24614,4 +24673,4 @@
"checked": "2026-11-01"
}
]
-}
+}
\ No newline at end of file
diff --git a/docs/research/fuobe-originals-recipes-5.md b/docs/research/fuobe-originals-recipes-5.md
index bcced72d..d8e404f3 100644
--- a/docs/research/fuobe-originals-recipes-5.md
+++ b/docs/research/fuobe-originals-recipes-5.md
@@ -486,6 +486,11 @@ Train only on images Fuobe owns or has licensed for AI training (own shoots, pur
| `fuobe-underwater` | style | Underwater | 40+ licensed underwater portraits | fal-ai/z-image-turbo-trainer-v2 | 1,500 | strength 0.8 |
| `fuobe-paper-collage` | style | Paper Face, Object Makeup | 50+ physical paper collages photographed by Fuobe | fal-ai/z-image-trainer training_type=style | 2,000 | strength 0.8 |
| `fuobe-beauty-details` | concept | Grillz Selfie, Bleached Brows, Long legs, Creatures | one small set per concept (20-40 images each), own or licensed | fal-ai/z-image-turbo-trainer-v2, one LoRA per concept | 1,000-1,500 each | strength 0.7 |
+| `fuobe-push-in` | motion (Wan 2.2 I2V) | Eyes In, Mouth In, Eating Zoom | 20-40 own-shot push-in clips (2-5 s, 16 fps), released people only | fal-ai/wan-22-trainer/i2v-a14b or AI-Toolkit (wan22_14b_i2v) | 400-1,000 | strength 1.0, both experts |
+| `fuobe-timelapse` | motion (Wan 2.2 I2V) | Timelapse, Timelapse Human / Landscape / Glam, Hyperlapse | 30-60 own time-lapse and hyperlapse clips | fal-ai/wan-22-trainer/i2v-a14b or AI-Toolkit | 600-1,000 | strength 1.0, both experts |
+| `fuobe-drone-reveal` | motion (Wan 2.2 I2V) | Drone Reveal, Helicopter Shot, Flying | 30-60 own drone reveal clips | fal-ai/wan-22-trainer/i2v-a14b or AI-Toolkit | 600-1,000 | strength 1.0, both experts |
+
+*Added 2026-11-02 (o/o12-training-kit):* the three Wan 2.2 motion rows above (build plan O12) are in the JSON's `fuobeTrainedLoras` too, and every row there now has `group` and `status: "planned"`. The training kit (`scripts/train/`: a job spec and a data-licence log per LoRA, the checks, publishing to Fuobe's Hugging Face org) builds everything up to the run; nothing is trained yet. A row gains a `trained` block (pinned URL, SHA256, licence) when its file is published, and `gen-lora-library.py` then moves it from `PLANNED_LORAS` into the library. AI-Toolkit (main at e9c72b7, read 2026-11-02) trains Wan 2.2 I2V 14B as `wan22_14b_i2v` (`ai-toolkit/Wan2.2-I2V-A14B-Diffusers-bf16`, 4-bit with its accuracy recovery adapter, both experts) and Z-Image base as `zimage` (`Tongyi-MAI/Z-Image`). fal's three trainers' input schemas were read again the same day and match the JSON.
Approximate cost per LoRA on fal: Z-Image Turbo v2 at 2,000 steps $1.70; Z-Image base at 2,000 steps $4.52; Wan 2.2 I2V at 400–1,000 steps $2–5; LTX-2.3 i2v v2 at 2,000 steps $4.80 (prices from the trainers' llms.txt).
diff --git a/scripts/gen-lora-library.py b/scripts/gen-lora-library.py
index 62ca67a3..45354148 100644
--- a/scripts/gen-lora-library.py
+++ b/scripts/gen-lora-library.py
@@ -17,7 +17,13 @@ Licences are information (the owner's decision of 2026-10-27; Settings → Model
a default that uses a non-commercial LoRA, or sends one licensed for the user's GPU only to the cloud, is
printed as a licence note, never a failure.
+Fuobe's own LoRAs (research fuobeTrainedLoras, §6; the training kit in scripts/train/): until a trained file exists
+each one is a "planned" entry (PLANNED_LORAS) that no preset may use. Once scripts/train/publish.mjs has published the
+file and its data-licence log, the entry's `trained` block (pinned URL, SHA256, size, licence) moves it into the library.
+
Fails (exit 1) when an entry's data is wrong:
+- an entry without a licence snapshot (the licence as written, and commercial / hostedOk read on a date);
+- a preset, a motion / effect row or a Mixed Media look that uses a planned LoRA (no trained file yet);
- a civitai entry without a pinned version id or a permission snapshot, or whose commercial / hostedOk
flags disagree with its permissions (Image = outputs may be sold, Rent = may run on fal / Replicate);
- a file without a SHA256 pin, or a Hugging Face file without a pinned commit;
@@ -64,6 +70,9 @@ def permissions(licence):
def entry(raw, key, group, checked=None, spare=False):
where = f"{group} {key}"
lic = raw.get("licence") or ""
+ # Licences are information, but every entry carries one: the licence as written and what it allows, read on a date.
+ if not lic.strip() or not isinstance(raw.get("commercial"), bool) or not isinstance(raw.get("hostedOk"), bool):
+ errors.append(f"{where}: no licence snapshot (licence, commercial and hostedOk)")
perms = permissions(lic)
url = raw.get("url") or ""
out = {
@@ -213,7 +222,48 @@ for preset, ls in MIXED.items():
errors.append(f"mixed-media look {preset}: strength {l.get('strength')!r} out of range")
mixed[preset] = [{"key": l["key"], "strength": l["strength"]} for l in ls]
-keys = [e["key"] for e in library]
+# Fuobe's own LoRAs (§6 and the Wan 2.2 motion LoRAs): planned until a trained file is published with its data-licence log.
+OWN_ID = re.compile(r"^fuobe-[a-z0-9-]+$")
+planned = []
+for raw in DATA.get("fuobeTrainedLoras") or []:
+ key = raw["id"]
+ if not OWN_ID.match(key):
+ errors.append(f"own LoRA {key!r} is not a fuobe-… id")
+ group = raw.get("group") or "look"
+ trained = raw.get("trained")
+ if trained:
+ # Published (scripts/train/publish.mjs): an ordinary library entry, pinned and with its licence snapshot.
+ add(entry({"name": raw.get("name") or key, "base": raw["base"], **trained}, key, group, spare=key not in used))
+ continue
+ planned.append({
+ "key": key,
+ "base": raw["base"],
+ "group": group,
+ "kind": raw.get("kind") or "style",
+ "presets": [x.strip() for x in re.split(r",(?![^(]*\))", re.sub(r"\s*\(.*?\)", "", raw.get("presets") or "")) if x.strip()],
+ "file": f"{key}.safetensors",
+ "status": "planned",
+ "trainer": raw.get("trainer") or "",
+ "spec": f"scripts/train/specs/{key}.json",
+ "dataLog": f"scripts/train/data-logs/{key}.json",
+ # What the data will be: Fuobe's own or licensed for AI training, logged item by item before any run.
+ "licence": {"commercial": True, "hostedOk": True, "snapshotDate": AS_OF, "name": "Fuobe's own (data-licence log)"},
+ })
+planned_ids = {p["key"] for p in planned} | {p["file"] for p in planned}
+for p in DATA["presets"]:
+ for l in p.get("loras") or []:
+ if l.get("key") in planned_ids or l.get("file") in planned_ids:
+ errors.append(f"preset {p['name']}: uses the planned LoRA {l.get('key') or l.get('file')} (no trained file yet)")
+for m in DATA["motionsEffects"]:
+ for l in m.get("loras") or []:
+ if l.get("file") in planned_ids:
+ errors.append(f"{m['kind']} {', '.join(m['presets'][:3])}: uses the planned LoRA {l['file']} (no trained file yet)")
+for preset, ls in MIXED.items():
+ for l in ls:
+ if l.get("key") in planned_ids:
+ errors.append(f"mixed-media look {preset}: uses the planned LoRA {l['key']} (no trained file yet)")
+
+keys = [e["key"] for e in library] + [p["key"] for p in planned]
dup = sorted({k for k in keys if keys.count(k) > 1})
if dup:
errors.append(f"duplicate keys: {dup}")
@@ -226,15 +276,17 @@ if notes:
ts = (
"// Generated by scripts/gen-lora-library.py from docs/research/fuobe-originals-recipes-5.json — do not edit by hand.\n"
- 'import type { LoraEntry, MotionEffectLoras } from "./loras";\n\n'
+ 'import type { LoraEntry, MotionEffectLoras, PlannedLora } from "./loras";\n\n'
f"/** When the LoRA research (licences, civitai permissions, pinned versions) was read. */\n"
f"export const LORA_LIBRARY_AS_OF = {json.dumps(AS_OF)};\n\n"
"/** Every LoRA the Originals use: Soul looks (group \"look\"), motion / effect LoRAs and the adapters a recipe always loads, one entry per local file. */\n"
f"export const LORA_LIBRARY: LoraEntry[] = {json.dumps(library, indent=2, ensure_ascii=False)};\n\n"
"/** Motion and effect presets (Higgsfield's generic names) → their LoRA keys in LORA_LIBRARY, with the research's status. */\n"
f"export const MOTION_EFFECT_LORAS: MotionEffectLoras[] = {json.dumps(motions, indent=2, ensure_ascii=False)};\n\n"
+ "/** Fuobe's own LoRAs not trained yet (research fuobeTrainedLoras; scripts/train/): no preset uses one until its file is published. */\n"
+ f"export const PLANNED_LORAS: PlannedLora[] = {json.dumps(planned, indent=2, ensure_ascii=False)};\n\n"
"/** Fuobe Mixed Media's looks (research studios[mixed-media].original.looks): preset id → the LORA_LIBRARY keys its frames are drawn with. */\n"
f"export const MIXED_MEDIA_LOOK_LORAS: Record<string, {{ key: string; strength: number }}[]> = {json.dumps(mixed, indent=2, ensure_ascii=False)};\n"
)
(ROOT / "src/lib/catalog/lora-library.generated.ts").write_text(ts, encoding="utf-8")
-print(f"wrote {len(library)} LoRAs ({sum(1 for e in library if e['group'] == 'look')} looks), {len(motions)} motion / effect rows and {len(mixed)} Mixed Media looks")
+print(f"wrote {len(library)} LoRAs ({sum(1 for e in library if e['group'] == 'look')} looks), {len(motions)} motion / effect rows, {len(mixed)} Mixed Media looks and {len(planned)} planned own LoRAs")
diff --git a/scripts/train/README.md b/scripts/train/README.md
new file mode 100644
index 00000000..39511381
--- /dev/null
+++ b/scripts/train/README.md
@@ -0,0 +1,130 @@
+# Training Fuobe's own LoRAs
+
+This kit covers everything up to the training run for the LoRAs Fuobe trains itself (research §6, build plan O12), and for
+the motion library. **None of these LoRAs has been trained yet.** Each one is a *planned* entry in the LoRA library
+(`PLANNED_LORAS` in `src/lib/catalog/lora-library.generated.ts`), and no preset uses it until its file is published.
+
+| Where | What |
+|---|---|
+| `specs/<id>.json` | The job spec: dataset size and caption rules, steps, rank, learning rate, trigger, the fal trainer and the AI-Toolkit model, and the file it becomes |
+| `data-logs/<id>.json` | The data-licence log: every image or clip, where it comes from, its licence or proof of ownership, and a release wherever people appear |
+| `src/lib/catalog/motion-library.json` | The motion library: driving clips for the 13 sports moves |
+| `src/lib/training-kit.ts` | The checks and the configs (pure logic, tested in `tests/training-kit.test.ts`) |
+| `kit.mjs` | The command line |
+
+## The LoRAs
+
+First wave: `fuobe-soul-core`, `fuobe-cctv`, `fuobe-ultrawide-05`. Then the Wan 2.2 I2V motion LoRAs: `fuobe-push-in`
+(Eyes In, Mouth In, Eating Zoom), `fuobe-timelapse` and `fuobe-drone-reveal`. The other seven §6 looks have specs too.
+`node scripts/train/kit.mjs list` shows each one with its log count and its fal price.
+
+`fuobe-beauty-details` stands for four small concept LoRAs (grillz, bleached brows, long legs, creatures). Copy its spec
+once per concept and add each concept to the research's `fuobeTrainedLoras` before the first run.
+
+## 1. Collect the data and log it
+
+Train only on what Fuobe shot itself, licensed with AI-training rights, or took from CC0 or public-domain sources.
+**Never use Higgsfield outputs, previews or prompts.** The checker refuses any log entry that mentions them.
+
+Put the dataset in one folder: `001.jpg` with its caption `001.txt` (clips: `001.mp4` with `001.txt`). Follow the caption
+rules in the spec, and put the trigger where the rules say. Then fill in `data-logs/<id>.json`:
+
+```json
+{
+ "lora": "fuobe-cctv",
+ "version": 1,
+ "reviewedBy": "who checked the log against the files",
+ "reviewedAt": "2026-11-20",
+ "items": [
+ {
+ "file": "001.jpg",
+ "sha256": "…64 hex…",
+ "source": "own-shoot",
+ "licence": "Fuobe's own",
+ "proof": "call sheet 2026-11-12, raw folder cctv/2026-11-12",
+ "author": "who shot it",
+ "date": "2026-11-12",
+ "people": true,
+ "consent": { "form": "release-2026-11-12-03", "date": "2026-11-12", "scope": ["ai-training"], "adults": true }
+ }
+ ]
+}
+```
+
+- `source` is one of `own-shoot`, `licensed`, `cc0` or `public-domain`. A `licensed` file also needs `"aiTraining": true`,
+ and only when its licence actually says it allows training.
+- `people: true` needs a signed release from each person that covers AI training, from adults only. Keep the release
+ forms themselves outside the repository. The log only names them. If the release references must stay private, keep
+ the log elsewhere and point `FUOBE_TRAIN_LOGS` at that folder.
+
+Check the log against the folder:
+
+```bash
+node scripts/train/kit.mjs check fuobe-cctv --dataset ~/datasets/fuobe-cctv
+```
+
+The check fails when the log has fewer or more files than the spec allows, when an entry is incomplete, when a file is in
+the folder but not in the log (or the other way round), when a file changed after it was logged (its SHA256), or when a
+file has no caption. A job does not start while any of these fails.
+
+## 2. Make the job
+
+```bash
+node scripts/train/kit.mjs job fuobe-cctv --dataset ~/datasets/fuobe-cctv --zip-url https://…/fuobe-cctv.zip
+```
+
+This writes two files to `.train/fuobe-cctv/`, which git ignores:
+
+- `fuobe-cctv.aitk.json`: the AI-Toolkit job for your own GPU (free). Run it with `python run.py <file>` in an
+ [ostris/ai-toolkit](https://github.com/ostris/ai-toolkit) checkout. Z-Image Turbo trains with ostris's training
+ adapter v2; Z-Image base and Wan 2.2 I2V 14B use AI-Toolkit's own defaults for those models (4-bit Wan with its
+ accuracy recovery adapter, both experts). Wan 2.2 14B needs a 24 GB card.
+- `fuobe-cctv.fal.json`: the request for the fal trainer, with only the fields that trainer's schema has
+ (`trainers.generated.ts`, from the research). Zip the same folder, upload it, and pass its URL as `--zip-url`. fal
+ bills per step. `kit.mjs list` shows the price.
+
+The kit does not submit anything: that takes a GPU or a fal key, and a person deciding to spend it.
+
+Notes to check on the first run:
+- fal's `fal-ai/z-image-trainer` trains on Z-Image base. Whether a base-trained LoRA behaves the same on Z-Image Turbo
+ (the model Soul runs on) is unverified, so compare it with the AI-Toolkit Turbo run.
+- fal's Wan 2.2 I2V trainer returns one file. Whether loading it on both experts works as intended is unverified.
+
+## 3. Publish the file
+
+Trained files go to Fuobe's Hugging Face organisation (`fuobe` by default; set `--org` or `FUOBE_HF_ORG` to change it),
+one model repo per LoRA, with the public half of the data-licence log next to the file. The public half says a release
+exists but leaves out its reference.
+
+```bash
+node scripts/train/kit.mjs publish fuobe-cctv --file output/fuobe-cctv/fuobe-cctv.safetensors # dry run
+HF_TOKEN=… node scripts/train/kit.mjs publish fuobe-cctv --file … --upload --write-research # publish
+pnpm gen:catalog
+```
+
+A dry run uploads nothing. It prints what would be uploaded and the `trained` block for the research entry. `--upload`
+needs a write token and the `hf` command (`pip install huggingface_hub`). It uploads the file, `data-licence-log.json`
+and a model card, then reads the commit the upload made. `--write-research` writes the `trained` block into
+`docs/research/fuobe-originals-recipes-5.json` (`fuobeTrainedLoras[<id>].trained`).
+
+After that, `pnpm gen:catalog` (`scripts/gen-lora-library.py`) moves the entry from `PLANNED_LORAS` into `LORA_LIBRARY`.
+The entry is pinned to that commit and SHA256, carries its licence snapshot, and downloads like any other library LoRA
+(`src/server/loras.ts`). Only then can a preset use it. Point the preset's LoRA at it in the research, regenerate, and
+let the evaluation harness (`scripts/eval`) compare it with the current recipe before it becomes a default.
+
+## The motion library
+
+The 13 sports moves (Baseball Kick … Snowboard Powder) work better as motion transfer than as a LoRA. Each move needs
+a short driving clip (2–10 s, at least 480 px) that is CC0, public domain or shot by Fuobe, with the same licence fields
+as a data-licence log entry (a release where people appear). Add clips to `src/lib/catalog/motion-library.json`
+under the move:
+
+```json
+{ "url": "https://huggingface.co/fuobe/motion-library/resolve/<commit>/boxing-01.mp4", "sha256": "…", "seconds": 5, "fps": 24,
+ "width": 1080, "height": 1920, "source": "own-shoot", "licence": "Fuobe's own", "proof": "…", "author": "…",
+ "date": "2026-11-20", "people": true, "consent": { "form": "…", "date": "…", "scope": ["ai-training"], "adults": true } }
+```
+
+`node scripts/train/kit.mjs motions` checks them. `motionLibraryClip(presetId)` in `src/lib/training-kit.ts` returns a
+move's first clip that passes. Until a move has one, it keeps its current route (Fuobe DoP on the move's words). The
+step that runs a move from its clip (Fuobe Genjutsu motion transfer, `maker` in the manifest) is not wired yet.
diff --git a/scripts/train/data-logs/fuobe-beauty-details.json b/scripts/train/data-logs/fuobe-beauty-details.json
new file mode 100644
index 00000000..4419c30f
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-beauty-details.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-beauty-details",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-cctv.json b/scripts/train/data-logs/fuobe-cctv.json
new file mode 100644
index 00000000..a248b28c
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-cctv.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-cctv",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-drone-reveal.json b/scripts/train/data-logs/fuobe-drone-reveal.json
new file mode 100644
index 00000000..74c4832e
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-drone-reveal.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-drone-reveal",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-frutiger-aero.json b/scripts/train/data-logs/fuobe-frutiger-aero.json
new file mode 100644
index 00000000..1a21d093
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-frutiger-aero.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-frutiger-aero",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-old-phone.json b/scripts/train/data-logs/fuobe-old-phone.json
new file mode 100644
index 00000000..9b60b4c2
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-old-phone.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-old-phone",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-paper-collage.json b/scripts/train/data-logs/fuobe-paper-collage.json
new file mode 100644
index 00000000..c34b2da0
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-paper-collage.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-paper-collage",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-push-in.json b/scripts/train/data-logs/fuobe-push-in.json
new file mode 100644
index 00000000..10ca713b
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-push-in.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-push-in",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-scale-surreal.json b/scripts/train/data-logs/fuobe-scale-surreal.json
new file mode 100644
index 00000000..d3a9b733
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-scale-surreal.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-scale-surreal",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-soul-core.json b/scripts/train/data-logs/fuobe-soul-core.json
new file mode 100644
index 00000000..3123d8a2
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-soul-core.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-soul-core",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-through-glass.json b/scripts/train/data-logs/fuobe-through-glass.json
new file mode 100644
index 00000000..8e2093b6
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-through-glass.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-through-glass",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-timelapse.json b/scripts/train/data-logs/fuobe-timelapse.json
new file mode 100644
index 00000000..2ebe7eed
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-timelapse.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-timelapse",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-ultrawide-05.json b/scripts/train/data-logs/fuobe-ultrawide-05.json
new file mode 100644
index 00000000..b02f708f
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-ultrawide-05.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-ultrawide-05",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/data-logs/fuobe-underwater.json b/scripts/train/data-logs/fuobe-underwater.json
new file mode 100644
index 00000000..2d880823
--- /dev/null
+++ b/scripts/train/data-logs/fuobe-underwater.json
@@ -0,0 +1,7 @@
+{
+ "lora": "fuobe-underwater",
+ "version": 1,
+ "items": [],
+ "reviewedBy": "",
+ "reviewedAt": ""
+}
diff --git a/scripts/train/kit.mjs b/scripts/train/kit.mjs
new file mode 100644
index 00000000..4baf6757
--- /dev/null
+++ b/scripts/train/kit.mjs
@@ -0,0 +1,196 @@
+#!/usr/bin/env node
+/**
+ * Fuobe's training kit (build plan O12): job specs, data-licence logs, the motion library and publishing. Nothing here
+ * trains or uploads unless asked: `job` writes the configs a run takes, `publish` is a dry run without --upload.
+ *
+ * node scripts/train/kit.mjs list every spec, its log and its fal price
+ * node scripts/train/kit.mjs check <id>|--all [--dataset <dir>] the spec and its data-licence log (against the files)
+ * node scripts/train/kit.mjs job <id> --dataset <dir> [--zip-url <url>] [--out <dir>]
+ * the AI-Toolkit config and the fal request, once the log passes
+ * node scripts/train/kit.mjs motions the motion library's clips and licences
+ * node scripts/train/kit.mjs publish <id> --file <lora.safetensors> [--org fuobe] [--upload] [--write-research]
+ *
+ * See scripts/train/README.md.
+ */
+import crypto from "node:crypto";
+import { execFileSync } from "node:child_process";
+import fs from "node:fs";
+import { registerHooks } from "node:module";
+import path from "node:path";
+import { fileURLToPath, pathToFileURL } from "node:url";
+
+import { resolve } from "../lib/ts-paths.mjs";
+
+registerHooks({ resolve });
+process.removeAllListeners("warning");
+process.on("warning", (w) => (w.name !== "Warning" || !/Module type of/.test(w.message) ? console.warn(`${w.name}: ${w.message}`) : undefined));
+
+const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
+const TRAIN = path.join(ROOT, "scripts", "train");
+const RESEARCH = path.join(ROOT, "docs", "research", "fuobe-originals-recipes-5.json");
+const kit = await import(pathToFileURL(path.join(ROOT, "src/lib/training-kit.ts")).href);
+const { PLANNED_LORAS, LORA_LIBRARY } = await import(pathToFileURL(path.join(ROOT, "src/lib/catalog/lora-library.generated.ts")).href);
+
+const args = process.argv.slice(2);
+const cmd = args[0];
+const flag = (name) => args.includes(name);
+const opt = (name) => {
+ const i = args.indexOf(name);
+ return i >= 0 ? args[i + 1] : undefined;
+};
+const readJson = (p) => JSON.parse(fs.readFileSync(p, "utf8"));
+const specIds = () => fs.readdirSync(path.join(TRAIN, "specs")).filter((f) => f.endsWith(".json")).map((f) => f.replace(/\.json$/, "")).sort();
+const loadSpec = (id) => {
+ const p = path.join(TRAIN, "specs", `${id}.json`);
+ if (!fs.existsSync(p)) fail(`no spec scripts/train/specs/${id}.json`);
+ return readJson(p);
+};
+// The logs live in scripts/train/data-logs; FUOBE_TRAIN_LOGS points elsewhere (a private copy, or a test's).
+const LOGS = process.env.FUOBE_TRAIN_LOGS ?? path.join(TRAIN, "data-logs");
+const loadLog = (id) => {
+ const p = path.join(LOGS, `${id}.json`);
+ return fs.existsSync(p) ? readJson(p) : { lora: id, version: 1, items: [] };
+};
+const sha256 = (file) => crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
+function fail(msg) {
+ console.error(msg);
+ process.exit(1);
+}
+
+/** The dataset folder as the checker sees it: media files with their hashes, and the caption files. */
+function readDataset(dir, media) {
+ if (!dir) return undefined;
+ if (!fs.existsSync(dir)) fail(`no dataset folder ${dir}`);
+ const ext = media === "image" ? /\.(jpe?g|png|webp)$/i : /\.(mp4|mov|webm)$/i;
+ const names = fs.readdirSync(dir).sort();
+ return {
+ files: names.filter((n) => ext.test(n)).map((n) => ({ name: n, sha256: sha256(path.join(dir, n)) })),
+ captions: names.filter((n) => n.endsWith(".txt")),
+ };
+}
+
+function problemsOf(id, datasetDir) {
+ const spec = loadSpec(id);
+ const out = kit.specProblems(spec).map((p) => `spec: ${p}`);
+ out.push(...kit.dataLogProblems(loadLog(id), spec, readDataset(datasetDir, spec.media)).map((p) => `data-licence log: ${p}`));
+ return { spec, problems: out };
+}
+
+function report(id, problems) {
+ if (!problems.length) console.log(`${id}: ready`);
+ else console.log(`${id}: not ready\n ${problems.slice(0, 20).join("\n ")}${problems.length > 20 ? `\n … and ${problems.length - 20} more` : ""}`);
+}
+
+if (cmd === "list") {
+ for (const id of specIds()) {
+ const spec = loadSpec(id);
+ const log = loadLog(id);
+ const published = LORA_LIBRARY.some((e) => e.key === id);
+ const cost = kit.specCostUsd(spec);
+ console.log(`${id.padEnd(22)} ${published ? "published" : "planned "} ${spec.media} log ${String(log.items.length).padStart(3)}/${spec.dataset.min}-${spec.dataset.max} fal ${spec.routes.fal.trainer} ≈ $${cost?.toFixed(2)} (${spec.train.steps} steps) · AI-Toolkit ${spec.routes.aiToolkit.arch}: free on your GPU`);
+ }
+ const missing = PLANNED_LORAS.filter((p) => !specIds().includes(p.key)).map((p) => p.key);
+ if (missing.length) console.log(`planned without a spec: ${missing.join(", ")}`);
+} else if (cmd === "check") {
+ const ids = flag("--all") ? specIds() : [args[1]];
+ if (!ids[0] || ids[0].startsWith("--")) fail("usage: kit.mjs check <id>|--all [--dataset <dir>]");
+ let bad = 0;
+ for (const id of ids) {
+ const { problems } = problemsOf(id, flag("--all") ? undefined : opt("--dataset"));
+ report(id, problems);
+ if (problems.length) bad++;
+ }
+ process.exit(bad ? 1 : 0);
+} else if (cmd === "job") {
+ const id = args[1];
+ const dataset = opt("--dataset");
+ if (!id || !dataset) fail("usage: kit.mjs job <id> --dataset <dir> [--zip-url <url>] [--out <dir>]");
+ const { spec, problems } = problemsOf(id, dataset);
+ if (problems.length) {
+ report(id, problems);
+ fail(`\nThe job does not start until the spec and the data-licence log pass (scripts/train/README.md).`);
+ }
+ const out = path.resolve(opt("--out") ?? path.join(ROOT, ".train", id));
+ fs.mkdirSync(out, { recursive: true });
+ const aitk = kit.aiToolkitConfig(spec, path.resolve(dataset), path.join(out, "output"));
+ fs.writeFileSync(path.join(out, `${id}.aitk.json`), JSON.stringify(aitk, null, 2) + "\n");
+ const zip = opt("--zip-url");
+ if (zip) fs.writeFileSync(path.join(out, `${id}.fal.json`), JSON.stringify({ endpoint: spec.routes.fal.trainer, input: kit.falTrainingPayload(spec, zip) }, null, 2) + "\n");
+ console.log(`${id}: the data-licence log passes.`);
+ console.log(` Your GPU (free): python run.py ${path.join(out, `${id}.aitk.json`)} (in an ostris/ai-toolkit checkout)`);
+ console.log(zip ? ` fal (≈ $${kit.specCostUsd(spec)?.toFixed(2)}): submit ${path.join(out, `${id}.fal.json`)} to ${spec.routes.fal.trainer}` : ` fal: zip the dataset (001.jpg + 001.txt pairs), upload it, and pass --zip-url for the request`);
+ console.log(` Not run here. Then: kit.mjs publish ${id} --file <the trained .safetensors>`);
+} else if (cmd === "motions") {
+ const research = readJson(RESEARCH);
+ const row = research.motionsEffects.find((m) => m.status === "motion-library");
+ const problems = kit.motionLibraryProblems(kit.MOTION_LIBRARY, row?.presets ?? []);
+ for (const m of kit.MOTION_LIBRARY.moves) {
+ const clip = kit.motionLibraryClip(m.presetId);
+ console.log(`${m.preset.padEnd(18)} ${m.clips.length} clip(s) ${clip ? `→ runs from ${clip.url}` : "keeps its current route (no checked clip yet)"}`);
+ }
+ if (problems.length) fail(`\nmotion library:\n ${problems.join("\n ")}`);
+} else if (cmd === "publish") {
+ const id = args[1];
+ const file = opt("--file");
+ if (!id || !file) fail("usage: kit.mjs publish <id> --file <lora.safetensors> [--org fuobe] [--upload] [--write-research]");
+ if (!fs.existsSync(file) || !file.endsWith(".safetensors")) fail(`${file} is not a .safetensors file`);
+ const spec = loadSpec(id);
+ const log = loadLog(id);
+ const logProblems = kit.dataLogProblems(log, spec);
+ if (logProblems.length) {
+ report(id, logProblems.map((p) => `data-licence log: ${p}`));
+ fail("\nA file is published only with a complete data-licence log.");
+ }
+ const org = opt("--org") ?? process.env.FUOBE_HF_ORG ?? spec.target.hfRepo.split("/")[0];
+ const repo = `${org}/${id}`;
+ const hash = sha256(file);
+ const size = fs.statSync(file).size;
+ const stage = fs.mkdtempSync(path.join(fs.realpathSync(process.env.TMPDIR ?? "/tmp"), `fuobe-publish-${id}-`));
+ fs.copyFileSync(file, path.join(stage, spec.target.file));
+ fs.writeFileSync(path.join(stage, "data-licence-log.json"), JSON.stringify(kit.publicLog(log), null, 2) + "\n");
+ fs.writeFileSync(
+ path.join(stage, "README.md"),
+ `---\nlicense: apache-2.0\nbase_model: ${spec.base}\ntags: [lora, fuobe]\n---\n\n# ${spec.name}\n\nA LoRA Fuobe trained on its own or licensed data (${log.items.length} ${spec.media === "image" ? "images" : "clips"}). Every file's source, licence and release is in data-licence-log.json.\n\n- Trigger: \`${spec.trigger}\`\n- Strength: ${spec.target.strength}\n- File: ${spec.target.file} (SHA256 ${hash})\n`,
+ );
+ const trained = (revision) => ({
+ file: spec.target.file,
+ url: `https://huggingface.co/${repo}/resolve/main/${spec.target.file}`,
+ page: `https://huggingface.co/${repo}`,
+ strength: spec.target.strength,
+ trigger: spec.trigger,
+ ...(spec.target.loraTarget && { target: spec.target.loraTarget }),
+ download: "direct",
+ licence: "Apache-2.0 (Fuobe's own data, data-licence log)",
+ commercial: true,
+ hostedOk: true,
+ checked: new Date().toISOString().slice(0, 10),
+ revision,
+ sha256: hash,
+ sizeBytes: size,
+ });
+ console.log(`${id} → https://huggingface.co/${repo}\n ${spec.target.file} (${size} bytes, SHA256 ${hash}), data-licence-log.json, README.md\n staged in ${stage}`);
+ if (!flag("--upload")) {
+ console.log(`\nDry run: nothing uploaded. Add --upload (with HF_TOKEN set and the hf command installed) to publish.`);
+ console.log(`The research entry's trained block will be:\n${JSON.stringify(trained("<the commit the upload makes>"), null, 1)}`);
+ process.exit(0);
+ }
+ if (!process.env.HF_TOKEN) fail("HF_TOKEN is not set: a write token for the organisation is needed to upload.");
+ execFileSync("hf", ["repo", "create", repo, "--repo-type", "model", "--exist-ok"], { stdio: "inherit" });
+ execFileSync("hf", ["upload", repo, stage, ".", "--repo-type", "model", "--commit-message", `${spec.name}: the trained file and its data-licence log`], { stdio: "inherit" });
+ const info = await fetch(`https://huggingface.co/api/models/${repo}`, { headers: { authorization: `Bearer ${process.env.HF_TOKEN}` } }).then((r) => r.json());
+ if (!/^[0-9a-f]{40}$/.test(info.sha ?? "")) fail(`could not read the commit of ${repo}`);
+ const block = trained(info.sha);
+ console.log(`Published at commit ${info.sha}.`);
+ if (flag("--write-research")) {
+ const text = fs.readFileSync(RESEARCH, "utf8");
+ const research = JSON.parse(text);
+ const entry = research.fuobeTrainedLoras.find((x) => x.id === id);
+ if (!entry) fail(`${id} is not in the research's fuobeTrainedLoras`);
+ entry.trained = block;
+ entry.status = "trained";
+ fs.writeFileSync(RESEARCH, JSON.stringify(research, null, 1));
+ console.log(`Wrote the trained block to docs/research/fuobe-originals-recipes-5.json. Now run: pnpm gen:catalog`);
+ } else console.log(`Add this as fuobeTrainedLoras[${id}].trained in the research, then run pnpm gen:catalog:\n${JSON.stringify(block, null, 1)}`);
+} else {
+ fail("usage: kit.mjs list | check <id>|--all [--dataset <dir>] | job <id> --dataset <dir> [--zip-url <url>] [--out <dir>] | motions | publish <id> --file <f> [--upload] [--write-research]");
+}
diff --git a/scripts/train/specs/fuobe-beauty-details.json b/scripts/train/specs/fuobe-beauty-details.json
new file mode 100644
index 00000000..924074d7
--- /dev/null
+++ b/scripts/train/specs/fuobe-beauty-details.json
@@ -0,0 +1,42 @@
+{
+ "id": "fuobe-beauty-details",
+ "name": "Fuobe beauty details",
+ "kind": "concept",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "Grillz Selfie",
+ "Bleached Brows",
+ "Long legs",
+ "Creatures"
+ ],
+ "trigger": "fbbeautydetail",
+ "dataset": {
+ "min": 20,
+ "max": 40,
+ "what": "One small set per concept (grillz, bleached brows, low-angle long legs, creature fusion), Fuobe's own or licensed.",
+ "captions": [
+ "Every caption starts with \"fbbeautydetail, \" and names the detail in the same words each time, then the scene in one long sentence.",
+ "No names of people, brands or photographers."
+ ]
+ },
+ "train": {
+ "steps": 1200,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-turbo-trainer-v2"
+ },
+ "aiToolkit": {
+ "arch": "zimage:turbo"
+ }
+ },
+ "target": {
+ "file": "fuobe-beauty-details.safetensors",
+ "strength": 0.7,
+ "hfRepo": "fuobe/fuobe-beauty-details"
+ },
+ "notes": "The plan trains one LoRA per concept: copy this spec per concept (fuobe-grillz, fuobe-bleached-brows, fuobe-long-legs, fuobe-creatures) and add each to the research's fuobeTrainedLoras before the first run."
+}
diff --git a/scripts/train/specs/fuobe-cctv.json b/scripts/train/specs/fuobe-cctv.json
new file mode 100644
index 00000000..e2d0c7ca
--- /dev/null
+++ b/scripts/train/specs/fuobe-cctv.json
@@ -0,0 +1,40 @@
+{
+ "id": "fuobe-cctv",
+ "name": "Fuobe CCTV",
+ "kind": "style",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "CCTV"
+ ],
+ "trigger": "fbcctv",
+ "dataset": {
+ "min": 40,
+ "max": 80,
+ "what": "Frames from cameras Fuobe controls (own CCTV, staged scenes with released actors); no timestamp or camera overlays in the frames.",
+ "captions": [
+ "Every caption starts with \"fbcctv style, \" and goes on in one or two long sentences (Z-Image style): who or what is in the picture, where, the light and the framing.",
+ "Describe the scene, never the look the LoRA learns (no \"grainy\", \"film look\" or the like), so the trigger carries it.",
+ "No names of people, places that identify someone, brands, camera models or photographers."
+ ]
+ },
+ "train": {
+ "steps": 1800,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-turbo-trainer-v2"
+ },
+ "aiToolkit": {
+ "arch": "zimage:turbo"
+ }
+ },
+ "target": {
+ "file": "fuobe-cctv.safetensors",
+ "strength": 0.8,
+ "hfRepo": "fuobe/fuobe-cctv"
+ },
+ "notes": "The timestamp and camera ID stay an overlay added after the picture."
+}
diff --git a/scripts/train/specs/fuobe-drone-reveal.json b/scripts/train/specs/fuobe-drone-reveal.json
new file mode 100644
index 00000000..9de22f13
--- /dev/null
+++ b/scripts/train/specs/fuobe-drone-reveal.json
@@ -0,0 +1,47 @@
+{
+ "id": "fuobe-drone-reveal",
+ "name": "Fuobe drone reveal",
+ "kind": "motion",
+ "base": "wan2.2-i2v-a14b",
+ "media": "video",
+ "presets": [
+ "Drone Reveal",
+ "Helicopter Shot",
+ "Flying"
+ ],
+ "trigger": "fbdronereveal",
+ "dataset": {
+ "min": 30,
+ "max": 60,
+ "what": "Own drone clips flown where flying is allowed: a rising or forward reveal over a landscape or a building; no people who did not sign a release.",
+ "captions": [
+ "Every caption starts with \"fbdronereveal, \" then says \"aerial drone rising reveal\" or \"aerial drone forward reveal\" in the same words each time, then what is in the first frame.",
+ "One sentence for what moves and one for what stays still; no text, logos or names."
+ ],
+ "clipSeconds": [
+ 2,
+ 5
+ ],
+ "fps": 16
+ },
+ "train": {
+ "steps": 800,
+ "rank": 32,
+ "learningRate": 0.0002
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b"
+ },
+ "aiToolkit": {
+ "arch": "wan22_14b_i2v"
+ }
+ },
+ "target": {
+ "file": "fuobe-drone-reveal.safetensors",
+ "strength": 1.0,
+ "loraTarget": "both",
+ "hfRepo": "fuobe/fuobe-drone-reveal"
+ },
+ "notes": "DroneShot and Set Reveal forbid selling outputs, so the move runs on words until this is trained."
+}
diff --git a/scripts/train/specs/fuobe-frutiger-aero.json b/scripts/train/specs/fuobe-frutiger-aero.json
new file mode 100644
index 00000000..c221cfcb
--- /dev/null
+++ b/scripts/train/specs/fuobe-frutiger-aero.json
@@ -0,0 +1,43 @@
+{
+ "id": "fuobe-frutiger-aero",
+ "name": "Fuobe Frutiger aero",
+ "kind": "style",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "Frutiger aero"
+ ],
+ "trigger": "fbaero",
+ "dataset": {
+ "min": 40,
+ "max": 60,
+ "what": "Renders Fuobe made itself (Blender, own designs).",
+ "captions": [
+ "Every caption starts with \"fbaero style, \" and goes on in one or two long sentences (Z-Image style): who or what is in the picture, where, the light and the framing.",
+ "Describe the scene, never the look the LoRA learns (no \"grainy\", \"film look\" or the like), so the trigger carries it.",
+ "No names of people, places that identify someone, brands, camera models or photographers."
+ ]
+ },
+ "train": {
+ "steps": 2000,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-trainer",
+ "extra": {
+ "training_type": "style"
+ }
+ },
+ "aiToolkit": {
+ "arch": "zimage"
+ }
+ },
+ "target": {
+ "file": "fuobe-frutiger-aero.safetensors",
+ "strength": 0.8,
+ "hfRepo": "fuobe/fuobe-frutiger-aero"
+ },
+ "notes": "fal trains on Z-Image base: whether a base-trained LoRA behaves the same on Z-Image Turbo (Soul's model) is unverified; compare it with the AI-Toolkit Turbo run on the first evaluation."
+}
diff --git a/scripts/train/specs/fuobe-old-phone.json b/scripts/train/specs/fuobe-old-phone.json
new file mode 100644
index 00000000..15feb825
--- /dev/null
+++ b/scripts/train/specs/fuobe-old-phone.json
@@ -0,0 +1,40 @@
+{
+ "id": "fuobe-old-phone",
+ "name": "Fuobe old phone",
+ "kind": "style",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "Old smartphone"
+ ],
+ "trigger": "fboldphone",
+ "dataset": {
+ "min": 60,
+ "max": 120,
+ "what": "Photos taken on real 2005-2012 camera phones Fuobe owns, or licensed with AI-training rights.",
+ "captions": [
+ "Every caption starts with \"fboldphone style, \" and goes on in one or two long sentences (Z-Image style): who or what is in the picture, where, the light and the framing.",
+ "Describe the scene, never the look the LoRA learns (no \"grainy\", \"film look\" or the like), so the trigger carries it.",
+ "No names of people, places that identify someone, brands, camera models or photographers."
+ ]
+ },
+ "train": {
+ "steps": 1500,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-turbo-trainer-v2"
+ },
+ "aiToolkit": {
+ "arch": "zimage:turbo"
+ }
+ },
+ "target": {
+ "file": "fuobe-old-phone.safetensors",
+ "strength": 0.8,
+ "hfRepo": "fuobe/fuobe-old-phone"
+ },
+ "notes": "A second option for the iPhone and DigitalCam looks once it is trained."
+}
diff --git a/scripts/train/specs/fuobe-paper-collage.json b/scripts/train/specs/fuobe-paper-collage.json
new file mode 100644
index 00000000..fa60a668
--- /dev/null
+++ b/scripts/train/specs/fuobe-paper-collage.json
@@ -0,0 +1,44 @@
+{
+ "id": "fuobe-paper-collage",
+ "name": "Fuobe paper collage",
+ "kind": "style",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "Paper Face",
+ "Object Makeup"
+ ],
+ "trigger": "fbpapercollage",
+ "dataset": {
+ "min": 50,
+ "max": 100,
+ "what": "Physical paper collages made and photographed by Fuobe.",
+ "captions": [
+ "Every caption starts with \"fbpapercollage style, \" and goes on in one or two long sentences (Z-Image style): who or what is in the picture, where, the light and the framing.",
+ "Describe the scene, never the look the LoRA learns (no \"grainy\", \"film look\" or the like), so the trigger carries it.",
+ "No names of people, places that identify someone, brands, camera models or photographers."
+ ]
+ },
+ "train": {
+ "steps": 2000,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-trainer",
+ "extra": {
+ "training_type": "style"
+ }
+ },
+ "aiToolkit": {
+ "arch": "zimage"
+ }
+ },
+ "target": {
+ "file": "fuobe-paper-collage.safetensors",
+ "strength": 0.8,
+ "hfRepo": "fuobe/fuobe-paper-collage"
+ },
+ "notes": "fal trains on Z-Image base: whether a base-trained LoRA behaves the same on Z-Image Turbo (Soul's model) is unverified; compare it with the AI-Toolkit Turbo run on the first evaluation."
+}
diff --git a/scripts/train/specs/fuobe-push-in.json b/scripts/train/specs/fuobe-push-in.json
new file mode 100644
index 00000000..ffc8519a
--- /dev/null
+++ b/scripts/train/specs/fuobe-push-in.json
@@ -0,0 +1,47 @@
+{
+ "id": "fuobe-push-in",
+ "name": "Fuobe push-in",
+ "kind": "motion",
+ "base": "wan2.2-i2v-a14b",
+ "media": "video",
+ "presets": [
+ "Eyes In",
+ "Mouth In",
+ "Eating Zoom"
+ ],
+ "trigger": "fbpushin",
+ "dataset": {
+ "min": 20,
+ "max": 40,
+ "what": "Own-shot push-in clips: a steady dolly or zoom into the eyes or the mouth of people who signed a release; no text or logos in frame.",
+ "captions": [
+ "Every caption starts with \"fbpushin, \" then says \"slow push in to an extreme close-up of the eyes\" or \"… of the mouth\" in the same words each time, then what is in the first frame.",
+ "One sentence for what moves and one for what stays still; no text, logos or names."
+ ],
+ "clipSeconds": [
+ 2,
+ 5
+ ],
+ "fps": 16
+ },
+ "train": {
+ "steps": 800,
+ "rank": 32,
+ "learningRate": 0.0002
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b"
+ },
+ "aiToolkit": {
+ "arch": "wan22_14b_i2v"
+ }
+ },
+ "target": {
+ "file": "fuobe-push-in.safetensors",
+ "strength": 1.0,
+ "loraTarget": "both",
+ "hfRepo": "fuobe/fuobe-push-in"
+ },
+ "notes": "Replaces the Wan 'eyes in' LoRA, which forbids selling outputs. fal's Wan 2.2 I2V trainer returns one file; loading it on both experts is unverified until the first run."
+}
diff --git a/scripts/train/specs/fuobe-scale-surreal.json b/scripts/train/specs/fuobe-scale-surreal.json
new file mode 100644
index 00000000..2fe0900d
--- /dev/null
+++ b/scripts/train/specs/fuobe-scale-surreal.json
@@ -0,0 +1,44 @@
+{
+ "id": "fuobe-scale-surreal",
+ "name": "Fuobe scale surreal",
+ "kind": "concept",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "Giant Accessory",
+ "Giant People",
+ "Help It's Too Big"
+ ],
+ "trigger": "fbgiantscale",
+ "dataset": {
+ "min": 40,
+ "max": 60,
+ "what": "Composites Fuobe made from its own photos: giant props, tiny worlds.",
+ "captions": [
+ "Every caption starts with \"fbgiantscale, \" and names what is giant and what is tiny in the same words each time, then the scene in one long sentence.",
+ "No names of people, brands or photographers."
+ ]
+ },
+ "train": {
+ "steps": 2000,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-trainer",
+ "extra": {
+ "training_type": "content"
+ }
+ },
+ "aiToolkit": {
+ "arch": "zimage"
+ }
+ },
+ "target": {
+ "file": "fuobe-scale-surreal.safetensors",
+ "strength": 0.8,
+ "hfRepo": "fuobe/fuobe-scale-surreal"
+ },
+ "notes": "fal trains on Z-Image base: whether a base-trained LoRA behaves the same on Z-Image Turbo (Soul's model) is unverified; compare it with the AI-Toolkit Turbo run on the first evaluation."
+}
diff --git a/scripts/train/specs/fuobe-soul-core.json b/scripts/train/specs/fuobe-soul-core.json
new file mode 100644
index 00000000..d1333ef9
--- /dev/null
+++ b/scripts/train/specs/fuobe-soul-core.json
@@ -0,0 +1,43 @@
+{
+ "id": "fuobe-soul-core",
+ "name": "Fuobe Soul core",
+ "kind": "style",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "every photographic Soul look"
+ ],
+ "trigger": "fbsoulcore",
+ "dataset": {
+ "min": 80,
+ "max": 150,
+ "what": "Editorial and street photos Fuobe shot or licensed with AI-training rights; varied skin tones, ages and light.",
+ "captions": [
+ "Every caption starts with \"fbsoulcore style, \" and goes on in one or two long sentences (Z-Image style): who or what is in the picture, where, the light and the framing.",
+ "Describe the scene, never the look the LoRA learns (no \"grainy\", \"film look\" or the like), so the trigger carries it.",
+ "No names of people, places that identify someone, brands, camera models or photographers."
+ ]
+ },
+ "train": {
+ "steps": 2500,
+ "rank": 32,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-trainer",
+ "extra": {
+ "training_type": "style"
+ }
+ },
+ "aiToolkit": {
+ "arch": "zimage"
+ }
+ },
+ "target": {
+ "file": "fuobe-soul-core.safetensors",
+ "strength": 0.6,
+ "hfRepo": "fuobe/fuobe-soul-core"
+ },
+ "notes": "Replaces the AWPortrait-Z + Lenovo pair in Soul's core slot once it wins the evaluation (scripts/eval). fal trains on Z-Image base: whether a base-trained LoRA behaves the same on Z-Image Turbo (Soul's model) is unverified; compare it with the AI-Toolkit Turbo run on the first evaluation."
+}
diff --git a/scripts/train/specs/fuobe-through-glass.json b/scripts/train/specs/fuobe-through-glass.json
new file mode 100644
index 00000000..102cc56c
--- /dev/null
+++ b/scripts/train/specs/fuobe-through-glass.json
@@ -0,0 +1,39 @@
+{
+ "id": "fuobe-through-glass",
+ "name": "Fuobe through the glass",
+ "kind": "style",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "Through The Glass"
+ ],
+ "trigger": "fbglass",
+ "dataset": {
+ "min": 40,
+ "max": 80,
+ "what": "Photos shot by Fuobe through fogged, reeded and rain-streaked glass.",
+ "captions": [
+ "Every caption starts with \"fbglass style, \" and goes on in one or two long sentences (Z-Image style): who or what is in the picture, where, the light and the framing.",
+ "Describe the scene, never the look the LoRA learns (no \"grainy\", \"film look\" or the like), so the trigger carries it.",
+ "No names of people, places that identify someone, brands, camera models or photographers."
+ ]
+ },
+ "train": {
+ "steps": 1500,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-turbo-trainer-v2"
+ },
+ "aiToolkit": {
+ "arch": "zimage:turbo"
+ }
+ },
+ "target": {
+ "file": "fuobe-through-glass.safetensors",
+ "strength": 0.8,
+ "hfRepo": "fuobe/fuobe-through-glass"
+ }
+}
diff --git a/scripts/train/specs/fuobe-timelapse.json b/scripts/train/specs/fuobe-timelapse.json
new file mode 100644
index 00000000..3d37f5e7
--- /dev/null
+++ b/scripts/train/specs/fuobe-timelapse.json
@@ -0,0 +1,49 @@
+{
+ "id": "fuobe-timelapse",
+ "name": "Fuobe timelapse",
+ "kind": "motion",
+ "base": "wan2.2-i2v-a14b",
+ "media": "video",
+ "presets": [
+ "Timelapse",
+ "Timelapse Human",
+ "Timelapse Landscape",
+ "Timelapse Glam",
+ "Hyperlapse"
+ ],
+ "trigger": "fbtimelapse",
+ "dataset": {
+ "min": 30,
+ "max": 60,
+ "what": "Own time-lapse and hyperlapse clips: skies, streets, people holding still while the world moves.",
+ "captions": [
+ "Every caption starts with \"fbtimelapse, \" then says \"time-lapse\" (or \"hyperlapse\" when the camera travels) in the same words each time, then what is in the first frame.",
+ "One sentence for what moves and one for what stays still; no text, logos or names."
+ ],
+ "clipSeconds": [
+ 2,
+ 5
+ ],
+ "fps": 16
+ },
+ "train": {
+ "steps": 800,
+ "rank": 32,
+ "learningRate": 0.0002
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b"
+ },
+ "aiToolkit": {
+ "arch": "wan22_14b_i2v"
+ }
+ },
+ "target": {
+ "file": "fuobe-timelapse.safetensors",
+ "strength": 1.0,
+ "loraTarget": "both",
+ "hfRepo": "fuobe/fuobe-timelapse"
+ },
+ "notes": "Replaces the Wan 2.2 Time-lapse LoRA, which forbids selling outputs."
+}
diff --git a/scripts/train/specs/fuobe-ultrawide-05.json b/scripts/train/specs/fuobe-ultrawide-05.json
new file mode 100644
index 00000000..129dec9b
--- /dev/null
+++ b/scripts/train/specs/fuobe-ultrawide-05.json
@@ -0,0 +1,40 @@
+{
+ "id": "fuobe-ultrawide-05",
+ "name": "Fuobe 0.5x ultrawide",
+ "kind": "style",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "0.5 Selfie",
+ "0.5 Outfit"
+ ],
+ "trigger": "fbwide05",
+ "dataset": {
+ "min": 60,
+ "max": 120,
+ "what": "Selfies and outfit shots the team took on phone 0.5x lenses, every person signed a release.",
+ "captions": [
+ "Every caption starts with \"fbwide05 style, \" and goes on in one or two long sentences (Z-Image style): who or what is in the picture, where, the light and the framing.",
+ "Describe the scene, never the look the LoRA learns (no \"grainy\", \"film look\" or the like), so the trigger carries it.",
+ "No names of people, places that identify someone, brands, camera models or photographers."
+ ]
+ },
+ "train": {
+ "steps": 1800,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-turbo-trainer-v2"
+ },
+ "aiToolkit": {
+ "arch": "zimage:turbo"
+ }
+ },
+ "target": {
+ "file": "fuobe-ultrawide-05.safetensors",
+ "strength": 0.7,
+ "hfRepo": "fuobe/fuobe-ultrawide-05"
+ }
+}
diff --git a/scripts/train/specs/fuobe-underwater.json b/scripts/train/specs/fuobe-underwater.json
new file mode 100644
index 00000000..12eb14e1
--- /dev/null
+++ b/scripts/train/specs/fuobe-underwater.json
@@ -0,0 +1,39 @@
+{
+ "id": "fuobe-underwater",
+ "name": "Fuobe underwater",
+ "kind": "style",
+ "base": "z-image-turbo",
+ "media": "image",
+ "presets": [
+ "Underwater"
+ ],
+ "trigger": "fbunderwater",
+ "dataset": {
+ "min": 40,
+ "max": 80,
+ "what": "Underwater portraits Fuobe shot or licensed with AI-training rights.",
+ "captions": [
+ "Every caption starts with \"fbunderwater style, \" and goes on in one or two long sentences (Z-Image style): who or what is in the picture, where, the light and the framing.",
+ "Describe the scene, never the look the LoRA learns (no \"grainy\", \"film look\" or the like), so the trigger carries it.",
+ "No names of people, places that identify someone, brands, camera models or photographers."
+ ]
+ },
+ "train": {
+ "steps": 1500,
+ "rank": 16,
+ "learningRate": 0.0001
+ },
+ "routes": {
+ "fal": {
+ "trainer": "fal-ai/z-image-turbo-trainer-v2"
+ },
+ "aiToolkit": {
+ "arch": "zimage:turbo"
+ }
+ },
+ "target": {
+ "file": "fuobe-underwater.safetensors",
+ "strength": 0.8,
+ "hfRepo": "fuobe/fuobe-underwater"
+ }
+}
diff --git a/src/lib/catalog/lora-library.generated.ts b/src/lib/catalog/lora-library.generated.ts
index 32e524eb..57473873 100644
--- a/src/lib/catalog/lora-library.generated.ts
+++ b/src/lib/catalog/lora-library.generated.ts
@@ -1,5 +1,5 @@
// Generated by scripts/gen-lora-library.py from docs/research/fuobe-originals-recipes-5.json — do not edit by hand.
-import type { LoraEntry, MotionEffectLoras } from "./loras";
+import type { LoraEntry, MotionEffectLoras, PlannedLora } from "./loras";
/** When the LoRA research (licences, civitai permissions, pinned versions) was read. */
export const LORA_LIBRARY_AS_OF = "2026-10-23";
@@ -4282,6 +4282,285 @@ export const MOTION_EFFECT_LORAS: MotionEffectLoras[] = [
}
];
+/** Fuobe's own LoRAs not trained yet (research fuobeTrainedLoras; scripts/train/): no preset uses one until its file is published. */
+export const PLANNED_LORAS: PlannedLora[] = [
+ {
+ "key": "fuobe-soul-core",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "style",
+ "presets": [
+ "every photographic preset"
+ ],
+ "file": "fuobe-soul-core.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-trainer training_type=style (Z-Image base, $2.26 per 1,000 steps), or AI-Toolkit on Z-Image base / Turbo + ostris training adapter v2",
+ "spec": "scripts/train/specs/fuobe-soul-core.json",
+ "dataLog": "scripts/train/data-logs/fuobe-soul-core.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-cctv",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "style",
+ "presets": [
+ "CCTV"
+ ],
+ "file": "fuobe-cctv.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-turbo-trainer-v2 ($0.85 per 1,000 steps) or AI-Toolkit",
+ "spec": "scripts/train/specs/fuobe-cctv.json",
+ "dataLog": "scripts/train/data-logs/fuobe-cctv.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-ultrawide-05",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "style",
+ "presets": [
+ "0.5 Selfie",
+ "0.5 Outfit"
+ ],
+ "file": "fuobe-ultrawide-05.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-turbo-trainer-v2 or AI-Toolkit",
+ "spec": "scripts/train/specs/fuobe-ultrawide-05.json",
+ "dataLog": "scripts/train/data-logs/fuobe-ultrawide-05.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-scale-surreal",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "concept",
+ "presets": [
+ "Giant Accessory",
+ "Giant People",
+ "Help It's Too Big"
+ ],
+ "file": "fuobe-scale-surreal.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-trainer training_type=content",
+ "spec": "scripts/train/specs/fuobe-scale-surreal.json",
+ "dataLog": "scripts/train/data-logs/fuobe-scale-surreal.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-through-glass",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "style",
+ "presets": [
+ "Through The Glass"
+ ],
+ "file": "fuobe-through-glass.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-turbo-trainer-v2",
+ "spec": "scripts/train/specs/fuobe-through-glass.json",
+ "dataLog": "scripts/train/data-logs/fuobe-through-glass.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-old-phone",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "style",
+ "presets": [
+ "Old smartphone"
+ ],
+ "file": "fuobe-old-phone.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-turbo-trainer-v2",
+ "spec": "scripts/train/specs/fuobe-old-phone.json",
+ "dataLog": "scripts/train/data-logs/fuobe-old-phone.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-frutiger-aero",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "style",
+ "presets": [
+ "Frutiger aero"
+ ],
+ "file": "fuobe-frutiger-aero.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-trainer training_type=style",
+ "spec": "scripts/train/specs/fuobe-frutiger-aero.json",
+ "dataLog": "scripts/train/data-logs/fuobe-frutiger-aero.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-underwater",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "style",
+ "presets": [
+ "Underwater"
+ ],
+ "file": "fuobe-underwater.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-turbo-trainer-v2",
+ "spec": "scripts/train/specs/fuobe-underwater.json",
+ "dataLog": "scripts/train/data-logs/fuobe-underwater.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-paper-collage",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "style",
+ "presets": [
+ "Paper Face",
+ "Object Makeup"
+ ],
+ "file": "fuobe-paper-collage.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-trainer training_type=style",
+ "spec": "scripts/train/specs/fuobe-paper-collage.json",
+ "dataLog": "scripts/train/data-logs/fuobe-paper-collage.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-beauty-details",
+ "base": "z-image-turbo",
+ "group": "look",
+ "kind": "concept",
+ "presets": [
+ "Grillz Selfie",
+ "Bleached Brows",
+ "Long legs",
+ "Creatures"
+ ],
+ "file": "fuobe-beauty-details.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/z-image-turbo-trainer-v2, one LoRA per concept",
+ "spec": "scripts/train/specs/fuobe-beauty-details.json",
+ "dataLog": "scripts/train/data-logs/fuobe-beauty-details.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-push-in",
+ "base": "wan2.2-i2v-a14b",
+ "group": "motion",
+ "kind": "motion",
+ "presets": [
+ "Eyes In",
+ "Mouth In",
+ "Eating Zoom"
+ ],
+ "file": "fuobe-push-in.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b, or AI-Toolkit (wan22_14b_i2v)",
+ "spec": "scripts/train/specs/fuobe-push-in.json",
+ "dataLog": "scripts/train/data-logs/fuobe-push-in.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-timelapse",
+ "base": "wan2.2-i2v-a14b",
+ "group": "motion",
+ "kind": "motion",
+ "presets": [
+ "Timelapse",
+ "Timelapse Human",
+ "Timelapse Landscape",
+ "Timelapse Glam",
+ "Hyperlapse"
+ ],
+ "file": "fuobe-timelapse.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b, or AI-Toolkit (wan22_14b_i2v)",
+ "spec": "scripts/train/specs/fuobe-timelapse.json",
+ "dataLog": "scripts/train/data-logs/fuobe-timelapse.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ },
+ {
+ "key": "fuobe-drone-reveal",
+ "base": "wan2.2-i2v-a14b",
+ "group": "motion",
+ "kind": "motion",
+ "presets": [
+ "Drone Reveal",
+ "Helicopter Shot",
+ "Flying"
+ ],
+ "file": "fuobe-drone-reveal.safetensors",
+ "status": "planned",
+ "trainer": "fal-ai/wan-22-trainer/i2v-a14b, or AI-Toolkit (wan22_14b_i2v)",
+ "spec": "scripts/train/specs/fuobe-drone-reveal.json",
+ "dataLog": "scripts/train/data-logs/fuobe-drone-reveal.json",
+ "licence": {
+ "commercial": true,
+ "hostedOk": true,
+ "snapshotDate": "2026-10-23",
+ "name": "Fuobe's own (data-licence log)"
+ }
+ }
+];
+
/** Fuobe Mixed Media's looks (research studios[mixed-media].original.looks): preset id → the LORA_LIBRARY keys its frames are drawn with. */
export const MIXED_MEDIA_LOOK_LORAS: Record<string, { key: string; strength: number }[]> = {
"mixed-layer-mixed-media": [
diff --git a/src/lib/catalog/loras.ts b/src/lib/catalog/loras.ts
index 51a845c2..74b0c145 100644
--- a/src/lib/catalog/loras.ts
+++ b/src/lib/catalog/loras.ts
@@ -40,6 +40,28 @@ export interface LoraEntry extends LoraRef {
notes?: string;
}
+/**
+ * One of Fuobe's own LoRAs before it is trained (research §6 and the Wan 2.2 motion LoRAs; scripts/train/): what it
+ * will be and where its job spec and data-licence log live. No preset uses one until its file is published.
+ */
+export interface PlannedLora {
+ key: string;
+ base: string;
+ group: "look" | "motion" | "effect";
+ kind: string;
+ /** The presets it is meant for (generic words). */
+ presets: string[];
+ /** The local file name it will have. */
+ file: string;
+ status: "planned";
+ /** The research's trainer line (hosted trainer and the AI-Toolkit route). */
+ trainer: string;
+ /** Its job spec and data-licence log in the repo. */
+ spec: string;
+ dataLog: string;
+ licence: LoraLicence;
+}
+
export interface MotionEffectLoras {
kind: "motion" | "effect";
/** Preset names (generic words) this row covers. */
diff --git a/src/lib/catalog/motion-library.json b/src/lib/catalog/motion-library.json
new file mode 100644
index 00000000..06297f66
--- /dev/null
+++ b/src/lib/catalog/motion-library.json
@@ -0,0 +1,71 @@
+{
+ "asOf": "2026-11-02",
+ "maker": "fuobe-genjutsu-motion",
+ "moves": [
+ {
+ "preset": "Baseball Kick",
+ "presetId": "motion-baseball-kick",
+ "clips": []
+ },
+ {
+ "preset": "Basketball Dunks",
+ "presetId": "motion-basketball-dunks",
+ "clips": []
+ },
+ {
+ "preset": "Boxing",
+ "presetId": "motion-boxing",
+ "clips": []
+ },
+ {
+ "preset": "Face Punch",
+ "presetId": "motion-face-punch",
+ "clips": []
+ },
+ {
+ "preset": "Moonwalk Left",
+ "presetId": "motion-moonwalk-left",
+ "clips": []
+ },
+ {
+ "preset": "Moonwalk Right",
+ "presetId": "motion-moonwalk-right",
+ "clips": []
+ },
+ {
+ "preset": "Skate Cruise",
+ "presetId": "motion-skate-cruise",
+ "clips": []
+ },
+ {
+ "preset": "Skateboard Glide",
+ "presetId": "motion-skateboard-glide",
+ "clips": []
+ },
+ {
+ "preset": "Skateboard Ollie",
+ "presetId": "motion-skateboard-ollie",
+ "clips": []
+ },
+ {
+ "preset": "Ski Carving",
+ "presetId": "motion-ski-carving",
+ "clips": []
+ },
+ {
+ "preset": "Ski Powder",
+ "presetId": "motion-ski-powder",
+ "clips": []
+ },
+ {
+ "preset": "Snowboard Carving",
+ "presetId": "motion-snowboard-carving",
+ "clips": []
+ },
+ {
+ "preset": "Snowboard Powder",
+ "presetId": "motion-snowboard-powder",
+ "clips": []
+ }
+ ]
+}
diff --git a/src/lib/training-kit.ts b/src/lib/training-kit.ts
new file mode 100644
index 00000000..559243a9
--- /dev/null
+++ b/src/lib/training-kit.ts
@@ -0,0 +1,368 @@
+/**
+ * The training kit for Fuobe's own LoRAs and the motion library (build plan O12; research §6 and §7). Pure logic, no
+ * I/O: scripts/train/kit.mjs reads the files and calls these.
+ *
+ * - A job spec (scripts/train/specs/<id>.json) says what one of Fuobe's own LoRAs learns from (dataset size, caption
+ * rules), how it trains (steps, rank, learning rate, trigger) on both routes (AI-Toolkit on a GPU, or a fal trainer
+ * whose request fields come from the research: trainers.generated.ts) and where the file goes (its library entry).
+ * - A data-licence log (scripts/train/data-logs/<id>.json) lists every image or clip of the dataset: where it comes
+ * from, its licence or proof of ownership, and consent where people appear. A job does not start while its log is
+ * incomplete, does not match the dataset, or uses anything Fuobe may not train on (Higgsfield outputs or previews).
+ * - The motion library (src/lib/catalog/motion-library.json) lists short CC0 or own-shot driving clips for the sports
+ * moves that are better as motion transfer than as a LoRA. A move picks a clip up only once one passes the check;
+ * until then it keeps its current route.
+ * - Publishing (scripts/train/kit.mjs publish) uploads a trained file with the public half of its log to Fuobe's
+ * Hugging Face org and writes the research entry's `trained` block, which `pnpm gen:catalog` turns into a library
+ * entry (scripts/gen-lora-library.py).
+ */
+import { PLANNED_LORAS, LORA_LIBRARY } from "./catalog/lora-library.generated";
+import type { PlannedLora } from "./catalog/loras";
+import { aiToolkitJob, getTrainer, trainerCost, type HostedTrainer } from "./catalog/training";
+import motionLibrary from "./catalog/motion-library.json" with { type: "json" };
+
+// ── Job specs ────────────────────────────────────────────────────────────────────────────────────────────────────
+
+/** The AI-Toolkit models the kit trains on (arch names from ostris/ai-toolkit's built-in models, main at e9c72b7, 2026-10-31). */
+export type AitkArch = "zimage:turbo" | "zimage" | "wan22_14b_i2v";
+
+export interface TrainingSpec {
+ /** fuobe-… id: the planned library entry it becomes. */
+ id: string;
+ name: string;
+ kind: "style" | "concept" | "motion";
+ /** The base the file is for (the library entry's base). */
+ base: "z-image-turbo" | "wan2.2-i2v-a14b";
+ media: "image" | "video";
+ /** The presets it is meant for (generic words). */
+ presets: string[];
+ /** A word the model doesn't know, written into every caption. */
+ trigger: string;
+ dataset: {
+ min: number;
+ max: number;
+ /** What the data is, in words. */
+ what: string;
+ /** The caption rules every caption follows. */
+ captions: string[];
+ /** Clips: their length in seconds and frame rate. */
+ clipSeconds?: [number, number];
+ fps?: number;
+ };
+ train: { steps: number; rank: number; learningRate: number };
+ routes: {
+ fal: { trainer: string; extra?: Record<string, string | number | boolean> };
+ aiToolkit: { arch: AitkArch };
+ };
+ target: {
+ file: string;
+ strength: number;
+ /** Wan 2.2: which expert(s) the LoRA loads on. */
+ loraTarget?: "high" | "low" | "both";
+ /** The Hugging Face repo it is published to (FUOBE_HF_ORG/<id>). */
+ hfRepo: string;
+ };
+ notes?: string;
+}
+
+const ID = /^fuobe-[a-z0-9-]+$/;
+const TRIGGER = /^[a-z][a-z0-9_]{3,31}$/;
+const BASE_OF: Record<AitkArch, TrainingSpec["base"][]> = { "zimage:turbo": ["z-image-turbo"], zimage: ["z-image-turbo"], wan22_14b_i2v: ["wan2.2-i2v-a14b"] };
+
+/** The planned entry a spec trains (or the library entry once its file is published). */
+export const plannedLora = (id: string): PlannedLora | undefined => PLANNED_LORAS.find((p) => p.key === id);
+
+/** The steps field of a trainer's request ("steps" on the image trainers, "number_of_steps" on Wan 2.2). */
+const stepsField = (tr: HostedTrainer) => (tr.fields.steps ? "steps" : tr.fields.number_of_steps ? "number_of_steps" : undefined);
+
+/** What is wrong with a spec (empty when it is ready to run once its data-licence log is complete). */
+export function specProblems(spec: TrainingSpec, planned: readonly PlannedLora[] = PLANNED_LORAS): string[] {
+ const out: string[] = [];
+ if (!ID.test(spec.id)) out.push(`id ${spec.id} is not a fuobe-… id`);
+ const entry = planned.find((p) => p.key === spec.id);
+ const published = LORA_LIBRARY.find((e) => e.key === spec.id);
+ if (!entry && !published) out.push(`${spec.id} is neither a planned LoRA nor in the library (add it to the research's fuobeTrainedLoras)`);
+ const base = entry?.base ?? published?.base;
+ if (base && base !== spec.base) out.push(`base ${spec.base} is not the library entry's ${base}`);
+ if (spec.target.file !== `${spec.id}.safetensors`) out.push(`target file must be ${spec.id}.safetensors`);
+ if (spec.target.hfRepo.split("/")[1] !== spec.id) out.push(`hfRepo ${spec.target.hfRepo} must be <org>/${spec.id}`);
+ if (!TRIGGER.test(spec.trigger)) out.push(`trigger ${spec.trigger} must be one lower-case word (4-32 letters, digits or _)`);
+ if (!(spec.target.strength > 0 && spec.target.strength <= 2)) out.push(`strength ${spec.target.strength} out of range`);
+ if (!spec.presets.length) out.push("no presets");
+ const d = spec.dataset;
+ if (!(Number.isInteger(d.min) && d.min > 0 && d.max >= d.min)) out.push(`dataset size ${d.min}-${d.max} is not a range`);
+ if (!d.captions.length || !d.captions.some((c) => c.includes(spec.trigger))) out.push(`caption rules must say where the trigger ${spec.trigger} goes`);
+ if (spec.media === "video" && !(d.clipSeconds && d.fps)) out.push("a motion LoRA's dataset needs clip lengths and a frame rate");
+ const t = spec.train;
+ if (!(Number.isInteger(t.rank) && t.rank >= 4 && t.rank <= 128)) out.push(`rank ${t.rank} out of range`);
+ if (!(t.learningRate > 0 && t.learningRate < 0.01)) out.push(`learning rate ${t.learningRate} out of range`);
+ const tr = getTrainer(spec.routes.fal.trainer);
+ if (!tr) out.push(`no hosted trainer ${spec.routes.fal.trainer} in the research (trainers.generated.ts)`);
+ else {
+ if (tr.media !== spec.media) out.push(`${tr.id} learns from ${tr.media}, the spec from ${spec.media}`);
+ if (tr.status !== "active") out.push(`${tr.id} is ${tr.status}`);
+ const sf = stepsField(tr);
+ const f = sf ? tr.fields[sf] : undefined;
+ if (!f) out.push(`${tr.id} takes no step count`);
+ else if ((f.min !== undefined && t.steps < f.min) || (f.max !== undefined && t.steps > f.max)) out.push(`${t.steps} steps is outside ${tr.id}'s ${f.min}-${f.max}`);
+ for (const [k, v] of Object.entries(spec.routes.fal.extra ?? {})) {
+ const field = tr.fields[k];
+ if (!field) out.push(`${tr.id} has no field ${k}`);
+ else if (field.enum && !field.enum.includes(v as string | number)) out.push(`${tr.id}'s ${k} takes ${field.enum.join(" | ")}, not ${v}`);
+ }
+ }
+ if (!BASE_OF[spec.routes.aiToolkit.arch]?.includes(spec.base)) out.push(`AI-Toolkit's ${spec.routes.aiToolkit.arch} does not train for ${spec.base}`);
+ if (spec.base.startsWith("wan2.2") && !spec.target.loraTarget) out.push("a Wan 2.2 LoRA says which expert it loads on (loraTarget)");
+ return out;
+}
+
+/** What fal bills for the spec's run, in US dollars (the trainer's per-step price above its minimum). */
+export const specCostUsd = (spec: TrainingSpec): number | null => trainerCost(getTrainer(spec.routes.fal.trainer), spec.train.steps);
+
+/**
+ * The hosted trainer's request: the dataset zip in its data field and only the fields its schema has (steps, the
+ * learning rate, the trigger or a default caption, and the spec's extra fields such as training_type).
+ */
+export function falTrainingPayload(spec: TrainingSpec, zipUrl: string): Record<string, unknown> {
+ const tr = getTrainer(spec.routes.fal.trainer);
+ if (!tr) throw new Error(`${spec.id}: no hosted trainer ${spec.routes.fal.trainer}`);
+ const f = tr.fields;
+ const body: Record<string, unknown> = { [tr.dataField]: zipUrl };
+ const sf = stepsField(tr);
+ if (sf) body[sf] = spec.train.steps;
+ if (f.learning_rate) body.learning_rate = spec.train.learningRate;
+ if (f.trigger_phrase) body.trigger_phrase = spec.trigger;
+ // Every file has its own caption (with the trigger); the default caption only fills in a missing one.
+ if (f.default_caption) body.default_caption = spec.kind === "style" ? `${spec.trigger} style` : spec.trigger;
+ for (const [k, v] of Object.entries(spec.routes.fal.extra ?? {})) if (f[k]) body[k] = v;
+ return body;
+}
+
+/** Sample prompts for the AI-Toolkit run: new scenes in the look, or a still the move animates. */
+function samples(spec: TrainingSpec): string[] {
+ if (spec.media === "video") return [`${spec.trigger}, a woman in a red coat on a city rooftop at dusk`, `${spec.trigger}, a mountain lake at sunrise`];
+ return [`a city street at night, ${spec.trigger} style`, `a bowl of fruit on a wooden table, ${spec.trigger} style`, `a portrait of a man in a garden, ${spec.trigger} style`];
+}
+
+/**
+ * The AI-Toolkit job for the user's GPU. Z-Image Turbo uses the Soul ID config (ostris's training adapter v2) with the
+ * spec's rank, steps and learning rate; Z-Image base and Wan 2.2 I2V 14B take AI-Toolkit's own defaults for those
+ * models (its UI's model list: Tongyi-MAI/Z-Image; ai-toolkit/Wan2.2-I2V-A14B-Diffusers-bf16 at 4 bit with its
+ * accuracy recovery adapter, both experts, 41 frames at 16 fps, linear timesteps).
+ */
+export function aiToolkitConfig(spec: TrainingSpec, datasetFolder: string, outputFolder: string) {
+ const job = aiToolkitJob({ name: spec.id, trigger: spec.trigger, datasetFolder, outputFolder, steps: spec.train.steps, kind: "style", family: "z-image-turbo" });
+ const proc = job.config.process[0] as Record<string, unknown> & { train: Record<string, unknown>; datasets: Record<string, unknown>[]; sample: Record<string, unknown> };
+ proc.network = { type: "lora", linear: spec.train.rank, linear_alpha: spec.train.rank };
+ proc.train.lr = spec.train.learningRate;
+ proc.sample.prompts = samples(spec);
+ const arch = spec.routes.aiToolkit.arch;
+ if (arch === "zimage") {
+ proc.model = { name_or_path: "Tongyi-MAI/Z-Image", arch: "zimage", quantize: true, qtype: "qfloat8", quantize_te: true, qtype_te: "qfloat8", low_vram: true };
+ proc.sample.sample_steps = 30;
+ proc.sample.guidance_scale = 4;
+ } else if (arch === "wan22_14b_i2v") {
+ proc.model = {
+ name_or_path: "ai-toolkit/Wan2.2-I2V-A14B-Diffusers-bf16",
+ arch: "wan22_14b_i2v",
+ quantize: true,
+ qtype: "uint4|ostris/accuracy_recovery_adapters/wan22_14b_i2v_torchao_uint4.safetensors",
+ quantize_te: true,
+ qtype_te: "qfloat8",
+ low_vram: true,
+ model_kwargs: { train_high_noise: true, train_low_noise: true },
+ };
+ proc.train.timestep_type = "linear";
+ proc.train.switch_boundary_every = 10;
+ proc.datasets = proc.datasets.map((d) => ({ ...d, resolution: [512], num_frames: 41, fps: spec.dataset.fps ?? 16 }));
+ Object.assign(proc.sample, { num_frames: 41, fps: 16, width: 832, height: 480, guidance_scale: 3.5, sample_steps: 25, sample_every: 250 });
+ }
+ return job;
+}
+
+// ── Data-licence logs ────────────────────────────────────────────────────────────────────────────────────────────
+
+/** Where a file comes from: shot by Fuobe, licensed with AI-training rights, CC0 or public domain. */
+export type DataSource = "own-shoot" | "licensed" | "cc0" | "public-domain";
+export const DATA_SOURCES: DataSource[] = ["own-shoot", "licensed", "cc0", "public-domain"];
+
+export interface DataLogItem {
+ /** The file's name in the dataset folder (001.jpg, clip-04.mp4). */
+ file: string;
+ sha256: string;
+ source: DataSource;
+ /** The licence as written ("CC0-1.0", "Fuobe's own", the stock licence's name). */
+ licence: string;
+ /** Where the proof is: the original's URL, the receipt or contract, the shoot's folder or call sheet. */
+ proof: string;
+ /** Who made it. */
+ author: string;
+ /** When it was made or licensed (YYYY-MM-DD). */
+ date: string;
+ /** A licensed file: its licence allows training AI models (said in the licence, not assumed). */
+ aiTraining?: boolean;
+ /** Recognisable people appear in it. */
+ people: boolean;
+ /** Each person's signed release covering AI training (the form's reference, kept off the public log). */
+ consent?: { form: string; date: string; scope: string[]; adults: boolean };
+}
+
+export interface DataLog {
+ lora: string;
+ version: 1;
+ items: DataLogItem[];
+ /** Who checked the log against the files, and when. */
+ reviewedBy?: string;
+ reviewedAt?: string;
+}
+
+const SHA = /^[0-9a-f]{64}$/;
+const DAY = /^\d{4}-\d{2}-\d{2}$/;
+/** Never training data (Higgsfield's terms §5.1(iii), §5.2(iv), §5.2(v); research §2). */
+const FORBIDDEN = /higgsfield/i;
+const MEDIA: Record<TrainingSpec["media"], RegExp> = { image: /\.(jpe?g|png|webp)$/i, video: /\.(mp4|mov|webm)$/i };
+
+/** A file in the dataset folder, as the kit read it. */
+export interface DatasetFile {
+ name: string;
+ sha256: string;
+}
+
+/** What is wrong with one item of a log (empty when it is complete). */
+export function itemProblems(item: DataLogItem, media?: TrainingSpec["media"]): string[] {
+ const out: string[] = [];
+ const at = item.file || "(no file)";
+ if (!item.file || item.file.includes("/")) out.push(`${at}: a plain file name`);
+ else if (media && !MEDIA[media].test(item.file)) out.push(`${at}: not ${media === "image" ? "an image" : "a clip"}`);
+ if (!SHA.test(item.sha256 ?? "")) out.push(`${at}: no SHA256`);
+ if (!DATA_SOURCES.includes(item.source)) out.push(`${at}: source must be ${DATA_SOURCES.join(", ")}`);
+ if (!item.licence?.trim()) out.push(`${at}: no licence`);
+ if (!item.proof?.trim()) out.push(`${at}: no licence or ownership proof`);
+ if (!item.author?.trim()) out.push(`${at}: no author`);
+ if (!DAY.test(item.date ?? "")) out.push(`${at}: no date`);
+ if (item.source === "licensed" && item.aiTraining !== true) out.push(`${at}: a licensed file needs a licence that allows AI training (aiTraining: true)`);
+ if ([item.proof, item.licence, item.author].some((s) => FORBIDDEN.test(s ?? ""))) out.push(`${at}: Higgsfield outputs and previews are never training data`);
+ if (typeof item.people !== "boolean") out.push(`${at}: say whether people appear (people: true or false)`);
+ if (item.people) {
+ const c = item.consent;
+ if (!c?.form?.trim() || !DAY.test(c.date ?? "")) out.push(`${at}: people appear, so it needs each person's signed release`);
+ else {
+ if (!c.scope?.includes("ai-training")) out.push(`${at}: the release must cover AI training (scope ai-training)`);
+ if (c.adults !== true) out.push(`${at}: only adults who signed a release`);
+ }
+ }
+ return out;
+}
+
+/**
+ * What stops a job from starting: the log's own gaps, its size against the spec, and, given the dataset folder, any
+ * file missing from the log, logged but not there, or changed since it was logged, and any file without a caption.
+ */
+export function dataLogProblems(log: DataLog, spec: Pick<TrainingSpec, "id" | "media" | "dataset">, folder?: { files: DatasetFile[]; captions: string[] }): string[] {
+ const out: string[] = [];
+ if (log.lora !== spec.id) out.push(`the log is for ${log.lora}, not ${spec.id}`);
+ const n = log.items?.length ?? 0;
+ if (n < spec.dataset.min) out.push(`${n} logged ${spec.media === "image" ? "images" : "clips"}; the spec needs ${spec.dataset.min}-${spec.dataset.max}`);
+ if (n > spec.dataset.max) out.push(`${n} logged files; the spec takes at most ${spec.dataset.max}`);
+ for (const item of log.items ?? []) out.push(...itemProblems(item, spec.media));
+ const names = (log.items ?? []).map((i) => i.file);
+ const dup = [...new Set(names.filter((x, i) => names.indexOf(x) !== i))];
+ if (dup.length) out.push(`logged twice: ${dup.join(", ")}`);
+ if (!log.reviewedBy?.trim() || !DAY.test(log.reviewedAt ?? "")) out.push("nobody has reviewed the log (reviewedBy, reviewedAt)");
+ if (folder) {
+ const logged = new Map((log.items ?? []).map((i) => [i.file, i]));
+ const present = new Map(folder.files.map((f) => [f.name, f]));
+ for (const f of folder.files) {
+ const item = logged.get(f.name);
+ if (!item) out.push(`${f.name} is in the dataset but not in the log`);
+ else if (item.sha256 !== f.sha256) out.push(`${f.name} changed since it was logged (SHA256 differs)`);
+ const stem = f.name.replace(/\.[^.]+$/, "");
+ if (!folder.captions.includes(`${stem}.txt`)) out.push(`${f.name} has no caption (${stem}.txt)`);
+ }
+ for (const name of logged.keys()) if (!present.has(name)) out.push(`${name} is logged but not in the dataset`);
+ }
+ return out;
+}
+
+/** The half of a log that is published next to the file: no release references, just that they exist. */
+export function publicLog(log: DataLog) {
+ return {
+ lora: log.lora,
+ version: log.version,
+ reviewedAt: log.reviewedAt,
+ items: log.items.map(({ consent, ...item }) => ({ ...item, ...(item.people && { consent: consent ? "signed release covering AI training, on file" : "missing" }) })),
+ };
+}
+
+// ── The motion library ──────────────────────────────────────────────────────────────────────────────────────────
+
+/** A driving clip: a short CC0 or own-shot performance of the move. */
+export interface MotionClip {
+ /** Pinned download (Fuobe's Hugging Face org, or another https file). */
+ url: string;
+ sha256: string;
+ seconds: number;
+ fps: number;
+ width: number;
+ height: number;
+ source: "own-shoot" | "cc0" | "public-domain";
+ licence: string;
+ proof: string;
+ author: string;
+ date: string;
+ people: boolean;
+ consent?: DataLogItem["consent"];
+}
+
+export interface MotionMove {
+ /** The preset's name (generic words, research §7: status motion-library). */
+ preset: string;
+ /** Its id in the DoP catalog. */
+ presetId: string;
+ clips: MotionClip[];
+}
+
+export interface MotionLibrary {
+ asOf: string;
+ /** What runs a move once a clip is present (both engines: Fuobe Genjutsu motion transfer). */
+ maker: string;
+ moves: MotionMove[];
+}
+
+/** Driving clips run as one part on every maker that takes them (SCAIL-2 takes 10 s at most). */
+export const MOTION_CLIP_SECONDS = { min: 2, max: 10 } as const;
+
+export function clipProblems(clip: MotionClip, at: string): string[] {
+ const asItem: DataLogItem = { file: "clip.mp4", sha256: clip.sha256, source: clip.source, licence: clip.licence, proof: clip.proof, author: clip.author, date: clip.date, people: clip.people, consent: clip.consent };
+ const out = itemProblems(asItem, "video").map((p) => p.replace(/^clip\.mp4/, at));
+ if (!["own-shoot", "cc0", "public-domain"].includes(clip.source)) out.push(`${at}: driving clips are CC0, public domain or shot by Fuobe`);
+ if (!/^https:\/\//.test(clip.url ?? "")) out.push(`${at}: no https download`);
+ if (!(clip.seconds >= MOTION_CLIP_SECONDS.min && clip.seconds <= MOTION_CLIP_SECONDS.max)) out.push(`${at}: ${clip.seconds} s; a driving clip runs ${MOTION_CLIP_SECONDS.min}-${MOTION_CLIP_SECONDS.max} s`);
+ if (!(clip.fps >= 12 && clip.fps <= 60)) out.push(`${at}: frame rate ${clip.fps}`);
+ if (!(clip.width >= 480 && clip.height >= 480)) out.push(`${at}: smaller than 480 px`);
+ return out;
+}
+
+/** What is wrong with the library: every motion-library move once, each clip complete. */
+export function motionLibraryProblems(lib: MotionLibrary, moves: readonly string[]): string[] {
+ const out: string[] = [];
+ const names = lib.moves.map((m) => m.preset);
+ for (const m of moves) if (!names.includes(m)) out.push(`${m} is missing`);
+ for (const n of names) if (!moves.includes(n)) out.push(`${n} is not a motion-library move`);
+ if (new Set(names).size !== names.length) out.push("a move is listed twice");
+ for (const m of lib.moves) {
+ if (!/^motion-[a-z0-9-]+$/.test(m.presetId)) out.push(`${m.preset}: preset id ${m.presetId}`);
+ m.clips.forEach((c, i) => out.push(...clipProblems(c, `${m.preset} clip ${i + 1}`)));
+ }
+ return out;
+}
+
+export const MOTION_LIBRARY = motionLibrary as MotionLibrary;
+
+/**
+ * The driving clip a move runs from, once the library has one that passes the check (the first). Until then
+ * undefined, and the move keeps its current route (Fuobe DoP on the move's words).
+ */
+export function motionLibraryClip(presetIdOrName: string, lib: MotionLibrary = MOTION_LIBRARY): MotionClip | undefined {
+ const move = lib.moves.find((m) => m.presetId === presetIdOrName || m.preset === presetIdOrName);
+ return move?.clips.find((c) => clipProblems(c, move.preset).length === 0);
+}
diff --git a/tests/training-kit.test.ts b/tests/training-kit.test.ts
new file mode 100644
index 00000000..48674ee2
--- /dev/null
+++ b/tests/training-kit.test.ts
@@ -0,0 +1,338 @@
+import { execFileSync, spawnSync } from "node:child_process";
+import crypto from "node:crypto";
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { describe, expect, it } from "vitest";
+import { getPreset } from "@/lib/catalog";
+import { LORA_LIBRARY, MOTION_EFFECT_LORAS, PLANNED_LORAS } from "@/lib/catalog/lora-library.generated";
+import { getTrainer } from "@/lib/catalog/training";
+import {
+ aiToolkitConfig,
+ dataLogProblems,
+ falTrainingPayload,
+ MOTION_LIBRARY,
+ motionLibraryClip,
+ motionLibraryProblems,
+ publicLog,
+ specCostUsd,
+ specProblems,
+ type DataLog,
+ type DataLogItem,
+ type MotionClip,
+ type TrainingSpec,
+} from "@/lib/training-kit";
+
+const ROOT = path.resolve(__dirname, "..");
+/** The parts of an AI-Toolkit process the tests read. */
+type Proc = { model: Record<string, unknown>; network: { linear: number }; train: Record<string, unknown>; datasets: Record<string, unknown>[]; trigger_word: string };
+const KIT = path.join(ROOT, "scripts/train/kit.mjs");
+const research = () => JSON.parse(fs.readFileSync(path.join(ROOT, "docs/research/fuobe-originals-recipes-5.json"), "utf8"));
+const specs: TrainingSpec[] = fs
+ .readdirSync(path.join(ROOT, "scripts/train/specs"))
+ .map((f) => JSON.parse(fs.readFileSync(path.join(ROOT, "scripts/train/specs", f), "utf8")));
+const spec = (id: string) => specs.find((s) => s.id === id)!;
+const sha = (s: string) => crypto.createHash("sha256").update(s).digest("hex");
+const item = (file: string, over: Partial<DataLogItem> = {}): DataLogItem => ({
+ file,
+ sha256: sha(file),
+ source: "own-shoot",
+ licence: "Fuobe's own",
+ proof: "shoot 2026-11 call sheet, folder cctv/raw",
+ author: "Fuobe team",
+ date: "2026-11-01",
+ people: false,
+ ...over,
+});
+const log = (id: string, n: number, over: Partial<DataLogItem> = {}): DataLog => ({
+ lora: id,
+ version: 1,
+ items: Array.from({ length: n }, (_, i) => item(`${String(i + 1).padStart(3, "0")}.jpg`, over)),
+ reviewedBy: "Fuobe team",
+ reviewedAt: "2026-11-02",
+});
+
+describe("training kit: job specs (scripts/train/specs)", () => {
+ it("has a spec for every planned own LoRA, the first three and the Wan 2.2 motion LoRAs among them", () => {
+ expect(specs.map((s) => s.id).sort()).toEqual(PLANNED_LORAS.map((p) => p.key).sort());
+ for (const id of ["fuobe-soul-core", "fuobe-cctv", "fuobe-ultrawide-05", "fuobe-push-in", "fuobe-timelapse", "fuobe-drone-reveal"]) expect(spec(id), id).toBeDefined();
+ // The §6 table and the three motion LoRAs of build plan O12.
+ expect(research().fuobeTrainedLoras).toHaveLength(13);
+ });
+
+ it("passes the spec check: trainer fields from the research, both routes, a target library entry", () => {
+ for (const s of specs) {
+ expect(specProblems(s), s.id).toEqual([]);
+ expect(specCostUsd(s), s.id).toBeGreaterThan(0);
+ expect(s.target.file).toBe(PLANNED_LORAS.find((p) => p.key === s.id)!.file);
+ }
+ // The Wan 2.2 motion LoRAs train on fal's Wan 2.2 A14B I2V trainer and load on both experts.
+ for (const id of ["fuobe-push-in", "fuobe-timelapse", "fuobe-drone-reveal"]) {
+ expect(spec(id).routes.fal.trainer).toBe("fal-ai/wan-22-trainer/i2v-a14b");
+ expect(spec(id).routes.aiToolkit.arch).toBe("wan22_14b_i2v");
+ expect(spec(id).target.loraTarget).toBe("both");
+ }
+ });
+
+ it("refuses a spec that doesn't fit its trainer or its entry", () => {
+ const s = spec("fuobe-cctv");
+ expect(specProblems({ ...s, train: { ...s.train, steps: 50_000 } }).join()).toMatch(/outside/);
+ expect(specProblems({ ...s, routes: { ...s.routes, fal: { trainer: "fal-ai/wan-22-trainer/i2v-a14b" } } }).join()).toMatch(/learns from video/);
+ expect(specProblems({ ...spec("fuobe-soul-core"), routes: { ...spec("fuobe-soul-core").routes, fal: { trainer: "fal-ai/z-image-trainer", extra: { training_type: "vibes" } } } }).join()).toMatch(/training_type takes/);
+ expect(specProblems({ ...s, id: "fuobe-unknown", target: { ...s.target, file: "fuobe-unknown.safetensors", hfRepo: "fuobe/fuobe-unknown" } }).join()).toMatch(/neither a planned LoRA/);
+ expect(specProblems({ ...s, trigger: "CCTV look" }).join()).toMatch(/trigger/);
+ expect(specProblems({ ...spec("fuobe-push-in"), target: { ...spec("fuobe-push-in").target, loraTarget: undefined } }).join()).toMatch(/expert/);
+ });
+
+ it("builds the fal request from the trainer's own fields", () => {
+ const style = falTrainingPayload(spec("fuobe-soul-core"), "https://example.com/d.zip");
+ expect(style).toEqual({ image_data_url: "https://example.com/d.zip", steps: 2500, learning_rate: 0.0001, default_caption: "fbsoulcore style", training_type: "style" });
+ const wan = falTrainingPayload(spec("fuobe-push-in"), "https://example.com/c.zip");
+ expect(wan).toEqual({ training_data_url: "https://example.com/c.zip", number_of_steps: 800, learning_rate: 0.0002, trigger_phrase: "fbpushin" });
+ for (const k of Object.keys(wan)) expect(getTrainer("fal-ai/wan-22-trainer/i2v-a14b")!.fields[k], k).toBeDefined();
+ });
+
+ it("builds the AI-Toolkit job for each base", () => {
+ const turbo = aiToolkitConfig(spec("fuobe-cctv"), "/data/cctv", "/out").config.process[0] as unknown as Proc;
+ expect(turbo.model.arch).toBe("zimage:turbo");
+ expect(turbo.model.assistant_lora_path).toMatch(/zimage_turbo_training_adapter_v2/);
+ expect(turbo.network).toEqual({ type: "lora", linear: 16, linear_alpha: 16 });
+ expect(turbo.train.steps).toBe(1800);
+ expect(turbo.trigger_word).toBe("fbcctv");
+ const base = aiToolkitConfig(spec("fuobe-soul-core"), "/d", "/o").config.process[0] as unknown as Proc;
+ expect(base.model).toMatchObject({ name_or_path: "Tongyi-MAI/Z-Image", arch: "zimage" });
+ expect(base.network.linear).toBe(32);
+ const wan = aiToolkitConfig(spec("fuobe-timelapse"), "/clips", "/o").config.process[0] as unknown as Proc;
+ expect(wan.model).toMatchObject({ arch: "wan22_14b_i2v", model_kwargs: { train_high_noise: true, train_low_noise: true } });
+ expect(wan.datasets[0]).toMatchObject({ folder_path: "/clips", num_frames: 41, fps: 16 });
+ expect(wan.train.timestep_type).toBe("linear");
+ });
+});
+
+describe("training kit: data-licence logs", () => {
+ const s = spec("fuobe-cctv");
+
+ it("ships an empty log per spec, so no job can start yet", () => {
+ for (const x of specs) {
+ const l = JSON.parse(fs.readFileSync(path.join(ROOT, "scripts/train/data-logs", `${x.id}.json`), "utf8"));
+ expect(l.lora).toBe(x.id);
+ expect(dataLogProblems(l, x).join(), x.id).toMatch(/logged/);
+ }
+ });
+
+ it("passes a complete log, and refuses each gap", () => {
+ expect(dataLogProblems(log("fuobe-cctv", 40), s)).toEqual([]);
+ expect(dataLogProblems(log("fuobe-cctv", 39), s).join()).toMatch(/39 logged images; the spec needs 40-80/);
+ expect(dataLogProblems({ ...log("fuobe-cctv", 40), reviewedBy: "" }, s).join()).toMatch(/reviewed/);
+ expect(dataLogProblems(log("fuobe-cctv", 40, { proof: "" }), s).join()).toMatch(/proof/);
+ expect(dataLogProblems(log("fuobe-cctv", 40, { source: "licensed" }), s).join()).toMatch(/allows AI training/);
+ expect(dataLogProblems(log("fuobe-cctv", 40, { source: "licensed", aiTraining: true }), s)).toEqual([]);
+ expect(dataLogProblems(log("fuobe-cctv", 40, { source: "scraped" as never }), s).join()).toMatch(/source must be/);
+ expect(dataLogProblems(log("fuobe-cctv", 40, { proof: "higgsfield.ai preview" }), s).join()).toMatch(/never training data/);
+ expect(dataLogProblems(log("fuobe-cctv", 40, { file: "001.mp4" }), s).join()).toMatch(/not an image/);
+ });
+
+ it("asks for a release covering AI training wherever people appear", () => {
+ expect(dataLogProblems(log("fuobe-cctv", 40, { people: true }), s).join()).toMatch(/signed release/);
+ const consent = { form: "release-2026-11-01-a", date: "2026-11-01", scope: ["ai-training", "marketing"], adults: true };
+ expect(dataLogProblems(log("fuobe-cctv", 40, { people: true, consent }), s)).toEqual([]);
+ expect(dataLogProblems(log("fuobe-cctv", 40, { people: true, consent: { ...consent, scope: ["marketing"] } }), s).join()).toMatch(/cover AI training/);
+ expect(dataLogProblems(log("fuobe-cctv", 40, { people: true, consent: { ...consent, adults: false } }), s).join()).toMatch(/only adults/);
+ // The published half keeps that a release exists, not its reference.
+ const pub = publicLog(log("fuobe-cctv", 1, { people: true, consent }));
+ expect(JSON.stringify(pub)).not.toMatch(/release-2026/);
+ expect(pub.items[0]).toMatchObject({ people: true, consent: "signed release covering AI training, on file" });
+ });
+
+ it("checks the log against the dataset folder: every file logged, unchanged and captioned", () => {
+ const l = log("fuobe-cctv", 40);
+ const files = l.items.map((i) => ({ name: i.file, sha256: i.sha256 }));
+ const captions = l.items.map((i) => i.file.replace(".jpg", ".txt"));
+ expect(dataLogProblems(l, s, { files, captions })).toEqual([]);
+ expect(dataLogProblems(l, s, { files: [...files, { name: "041.jpg", sha256: sha("x") }], captions }).join()).toMatch(/041.jpg is in the dataset but not in the log/);
+ expect(dataLogProblems(l, s, { files: files.slice(1), captions }).join()).toMatch(/001.jpg is logged but not in the dataset/);
+ expect(dataLogProblems(l, s, { files: [{ ...files[0], sha256: sha("edited") }, ...files.slice(1)], captions }).join()).toMatch(/changed since it was logged/);
+ expect(dataLogProblems(l, s, { files, captions: captions.slice(1) }).join()).toMatch(/001.jpg has no caption/);
+ });
+});
+
+describe("training kit: the LoRA library's planned entries", () => {
+ it("lists every own LoRA as planned, with a licence snapshot, and no preset uses one", () => {
+ expect(PLANNED_LORAS).toHaveLength(13);
+ const planned = new Set(PLANNED_LORAS.flatMap((p) => [p.key, p.file]));
+ for (const p of PLANNED_LORAS) {
+ expect(p.status).toBe("planned");
+ expect(p.licence.snapshotDate).toMatch(/^\d{4}-\d{2}-\d{2}$/);
+ expect(p.licence.name).toBeTruthy();
+ expect(LORA_LIBRARY.some((e) => e.key === p.key || e.file === p.file), p.key).toBe(false);
+ }
+ for (const m of MOTION_EFFECT_LORAS) for (const k of m.loras) expect(planned.has(k), k).toBe(false);
+ for (const p of research().presets) for (const l of p.loras ?? []) expect(planned.has(l.key) || planned.has(l.file), p.name).toBe(false);
+ // The looks waiting for one keep their current recipe (CCTV runs on words and the overlay).
+ expect(getPreset("motion-eyes-in")?.open?.loras).toBeUndefined();
+ });
+
+ it("is refused by the generator when a preset uses a planned LoRA or an entry has no licence snapshot; a trained block publishes it", () => {
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-kit-gen-"));
+ fs.mkdirSync(path.join(tmp, "scripts"));
+ fs.mkdirSync(path.join(tmp, "docs/research"), { recursive: true });
+ fs.mkdirSync(path.join(tmp, "src/lib/catalog"), { recursive: true });
+ fs.copyFileSync(path.join(ROOT, "scripts/gen-lora-library.py"), path.join(tmp, "scripts/gen-lora-library.py"));
+ const run = (data: unknown) => {
+ fs.writeFileSync(path.join(tmp, "docs/research/fuobe-originals-recipes-5.json"), JSON.stringify(data));
+ return execFileSync("python3", [path.join(tmp, "scripts/gen-lora-library.py")], { stdio: "pipe" }).toString();
+ };
+ try {
+ let data = research();
+ data.presets.find((p: { name: string }) => p.name === "CCTV").loras = [{ key: "fuobe-cctv", file: "fuobe-cctv.safetensors", strength: 0.8 }];
+ expect(() => run(data)).toThrow(/uses the planned LoRA fuobe-cctv/);
+ data = research();
+ delete data.loraLibrary.find((l: { key: string }) => l.key === "awportrait").licence;
+ expect(() => run(data)).toThrow(/awportrait: no licence snapshot/);
+ data = research();
+ data.loraLibrary.find((l: { key: string }) => l.key === "awportrait").hostedOk = undefined;
+ expect(() => run(data)).toThrow(/no licence snapshot/);
+ // Published (kit.mjs publish --write-research): the entry moves into the library, pinned, with its licence.
+ data = research();
+ const own = data.fuobeTrainedLoras.find((x: { id: string }) => x.id === "fuobe-cctv");
+ own.trained = {
+ file: "fuobe-cctv.safetensors",
+ url: "https://huggingface.co/fuobe/fuobe-cctv/resolve/main/fuobe-cctv.safetensors",
+ page: "https://huggingface.co/fuobe/fuobe-cctv",
+ strength: 0.8,
+ trigger: "fbcctv",
+ download: "direct",
+ licence: "Apache-2.0 (Fuobe's own data, data-licence log)",
+ commercial: true,
+ hostedOk: true,
+ checked: "2026-12-01",
+ revision: "a".repeat(40),
+ sha256: "b".repeat(64),
+ sizeBytes: 170_000_000,
+ };
+ expect(run(data)).toMatch(/12 planned own LoRAs/);
+ const ts = fs.readFileSync(path.join(tmp, "src/lib/catalog/lora-library.generated.ts"), "utf8");
+ expect(ts).toContain(`"url": "https://huggingface.co/fuobe/fuobe-cctv/resolve/${"a".repeat(40)}/fuobe-cctv.safetensors"`);
+ expect(ts).toContain(`"snapshotDate": "2026-12-01"`);
+ // Without its pins it is refused like any other file.
+ delete own.trained.sha256;
+ expect(() => run(data)).toThrow(/fuobe-cctv: no SHA256 pin/);
+ } finally {
+ fs.rmSync(tmp, { recursive: true, force: true });
+ }
+ });
+});
+
+describe("training kit: the motion library", () => {
+ const moves = research().motionsEffects.find((m: { status: string }) => m.status === "motion-library").presets as string[];
+ const clip = (over: Partial<MotionClip> = {}): MotionClip => ({
+ url: "https://huggingface.co/fuobe/motion-library/resolve/" + "c".repeat(40) + "/boxing-01.mp4",
+ sha256: sha("boxing"),
+ seconds: 5,
+ fps: 24,
+ width: 1080,
+ height: 1920,
+ source: "own-shoot",
+ licence: "Fuobe's own",
+ proof: "shoot 2026-11 sports day",
+ author: "Fuobe team",
+ date: "2026-11-01",
+ people: true,
+ consent: { form: "release-7", date: "2026-11-01", scope: ["ai-training"], adults: true },
+ ...over,
+ });
+
+ it("lists the 13 sports moves once each, with no clips yet, so every move keeps its current route", () => {
+ expect(moves).toHaveLength(13);
+ expect(motionLibraryProblems(MOTION_LIBRARY, moves)).toEqual([]);
+ for (const m of MOTION_LIBRARY.moves) {
+ expect(getPreset(m.presetId), m.presetId).toBeDefined();
+ expect(motionLibraryClip(m.presetId)).toBeUndefined();
+ // Until a clip is present the move is Fuobe DoP on its words, as before.
+ expect(getPreset(m.presetId)!.open?.loras).toBeUndefined();
+ }
+ });
+
+ it("checks each clip's licence fields and picks up the first clip that passes", () => {
+ const lib = { ...MOTION_LIBRARY, moves: MOTION_LIBRARY.moves.map((m) => (m.preset === "Boxing" ? { ...m, clips: [clip({ source: "licensed" as never }), clip()] } : m)) };
+ expect(motionLibraryProblems(lib, moves).join()).toMatch(/Boxing clip 1: driving clips are CC0/);
+ expect(motionLibraryClip("motion-boxing", lib)).toEqual(clip());
+ expect(motionLibraryClip("Boxing", lib)?.source).toBe("own-shoot");
+ expect(motionLibraryProblems({ ...lib, moves: lib.moves.slice(1) }, moves).join()).toMatch(/Baseball Kick is missing/);
+ const bad = (over: Partial<MotionClip>) => motionLibraryProblems({ ...MOTION_LIBRARY, moves: [{ ...MOTION_LIBRARY.moves[0], clips: [clip(over)] }, ...MOTION_LIBRARY.moves.slice(1)] }, moves).join();
+ expect(bad({ seconds: 14 })).toMatch(/2-10 s/);
+ expect(bad({ consent: undefined })).toMatch(/signed release/);
+ expect(bad({ url: "http://x/y.mp4" })).toMatch(/https/);
+ expect(bad({ source: "cc0", licence: "CC0-1.0", people: false, consent: undefined })).toBe("");
+ });
+});
+
+describe("training kit: the command line", () => {
+ const node = (args: string[]) => execFileSync("node", [KIT, ...args], { cwd: ROOT, stdio: "pipe" }).toString();
+ /** A refused command: its exit code and everything it printed. */
+ const refused = (args: string[]) => {
+ const r = spawnSync("node", [KIT, ...args], { cwd: ROOT, encoding: "utf8" });
+ return { status: r.status, out: r.stdout + r.stderr };
+ };
+
+ it("refuses a job whose data-licence log is incomplete", () => {
+ expect(refused(["check", "fuobe-cctv"])).toEqual({ status: 1, out: expect.stringMatching(/fuobe-cctv: not ready[\s\S]*0 logged images/) });
+ expect(refused(["check", "--all"]).status).toBe(1);
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-kit-data-"));
+ try {
+ expect(refused(["job", "fuobe-cctv", "--dataset", dir])).toEqual({ status: 1, out: expect.stringMatching(/does not start until/) });
+ } finally {
+ fs.rmSync(dir, { recursive: true, force: true });
+ }
+ });
+
+ it("writes both routes' configs once the log matches the dataset, and dry-runs a publish", () => {
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-kit-ok-"));
+ const data = path.join(tmp, "data");
+ const logs = path.join(tmp, "logs");
+ fs.mkdirSync(data);
+ fs.mkdirSync(logs);
+ const l = log("fuobe-cctv", 40);
+ for (const i of l.items) {
+ fs.writeFileSync(path.join(data, i.file), i.file);
+ fs.writeFileSync(path.join(data, i.file.replace(".jpg", ".txt")), "fbcctv style, a parking garage at night seen from a high corner");
+ }
+ fs.writeFileSync(path.join(logs, "fuobe-cctv.json"), JSON.stringify(l));
+ const env = { ...process.env, FUOBE_TRAIN_LOGS: logs };
+ const run = (args: string[]) => execFileSync("node", [KIT, ...args], { cwd: ROOT, env, stdio: "pipe" }).toString();
+ try {
+ expect(run(["check", "fuobe-cctv", "--dataset", data])).toMatch(/fuobe-cctv: ready/);
+ const out = path.join(tmp, "out");
+ expect(run(["job", "fuobe-cctv", "--dataset", data, "--zip-url", "https://example.com/cctv.zip", "--out", out])).toMatch(/Not run here/);
+ expect(JSON.parse(fs.readFileSync(path.join(out, "fuobe-cctv.aitk.json"), "utf8")).config.process[0].datasets[0].folder_path).toBe(data);
+ expect(JSON.parse(fs.readFileSync(path.join(out, "fuobe-cctv.fal.json"), "utf8"))).toEqual({ endpoint: "fal-ai/z-image-turbo-trainer-v2", input: { image_data_url: "https://example.com/cctv.zip", steps: 1800, learning_rate: 0.0001, default_caption: "fbcctv style" } });
+ // A changed image stops the job.
+ fs.writeFileSync(path.join(data, "007.jpg"), "edited");
+ expect(refused(["job", "fuobe-cctv", "--dataset", data]).status).toBe(1);
+ const file = path.join(tmp, "trained.safetensors");
+ fs.writeFileSync(file, "weights");
+ const dry = execFileSync("node", [KIT, "publish", "fuobe-cctv", "--file", file], { cwd: ROOT, env: { ...env, TMPDIR: tmp }, stdio: "pipe" }).toString();
+ expect(dry).toMatch(/Dry run: nothing uploaded/);
+ expect(dry).toContain(`"url": "https://huggingface.co/fuobe/fuobe-cctv/resolve/main/fuobe-cctv.safetensors"`);
+ expect(dry).toContain(`"sha256": "${sha("weights")}"`);
+ } finally {
+ fs.rmSync(tmp, { recursive: true, force: true });
+ }
+ });
+
+ it("lists the specs with their fal price, and the motion library's state", () => {
+ expect(node(["list"])).toMatch(/fuobe-cctv\s+planned\s+image\s+log\s+0\/40-80\s+fal fal-ai\/z-image-turbo-trainer-v2 ≈ \$1\.53/);
+ expect(node(["motions"])).toMatch(/Boxing\s+0 clip\(s\)\s+keeps its current route/);
+ });
+
+ it("publishes as a dry run by default, and never without a complete log", () => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-kit-pub-"));
+ const file = path.join(dir, "trained.safetensors");
+ fs.writeFileSync(file, "weights");
+ try {
+ expect(refused(["publish", "fuobe-cctv", "--file", file])).toEqual({ status: 1, out: expect.stringMatching(/only with a complete data-licence log/) });
+ } finally {
+ fs.rmSync(dir, { recursive: true, force: true });
+ }
+ });
+});