An agent skill (for Claude Code or any coding agent) that takes you end‑to‑end from an idea to a published Krea 2 image LoRA: research & assemble a dataset → train on fal → validate → publish to the Hugging Face Hub with a proper model card and native <Gallery />.
It encodes a proven recipe (and its hard‑won lessons) so you don't rediscover them each time.
Six phases (see SKILL.md):
- Scope & trigger phrase — style vs. character/object; pick a distinctive trigger.
- Research & source — find the best images for the subject (WikiArt API, museum APIs, Commons, the open web), not just one site.
- Curate & caption — vision‑assess candidates; motif‑diverse selection; captions tuned to style vs. subject.
- Optimize & package — sRGB, aspect‑preserved ≤2K, /16‑aligned, metadata stripped, numbered + captioned, zipped for fal.
- Train & validate —
fal-ai/krea-2-trainer(1000 steps, LR 5e‑4 defaults), then render previews at ~2K and look at them. - Publish — Krea‑style model card with the native
<Gallery />, private‑first.
- Train on RAW, run on Turbo.
- ~1000 steps is the sweet spot for a ~30‑image style set; more usually overcooks.
- Dataset + captions are the real quality levers (the trainer only exposes steps + learning_rate).
- Captions: style LoRA = content‑only (don't name the style); subject LoRA = name the subject.
- Feed native ~1.5–2K images, aspect‑preserved; never upscale.
- Render previews at ~1.5–2K, not 1024 — high‑frequency style detail is invisible at 1024 (the #1 cause of "the LoRA looks bad").
- Style and subject LoRAs conflict in one file — train separately and stack (the inference endpoint merges up to 3).
| script | purpose |
|---|---|
wikiart_fetch.py |
fetch/filter/download a candidate pool from the WikiArt API (one worked sourcing example) |
optimize_images.py |
turn a curated selection JSON into an optimized, captioned training set |
fal_train.py |
train a LoRA on fal-ai/krea-2-trainer, download weights, print the LoRA URL |
fal_sample.py |
render validation previews via fal-ai/krea-2/turbo/lora (defaults to ~1.5K) |
build_gallery.py |
static side‑by‑side A/B gallery (same seed) for comparing runs |
references/ holds the detailed recipe and a model‑card template.
- A fal account +
FAL_KEY(training/inference run on fal);pip install fal-client - The Hugging Face CLI (
hf) for publishing;pip install huggingface_hub - Python with Pillow; ImageMagick optional
git clone https://github.com/gary149/train-krea2-lora ~/.claude/skills/train-krea2-loraThen in Claude Code: /train-krea2-lora train a <subject> lora.
- Training/inference incur fal credits (~$2.80 per 1000‑step run).
- Respect source‑image copyright. For styles of living/recent artists or any real likeness, keep weights private and don't present outputs as authentic originals.