Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

train-krea2-lora

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.

What it does

Six phases (see SKILL.md):

  1. Scope & trigger phrase — style vs. character/object; pick a distinctive trigger.
  2. Research & source — find the best images for the subject (WikiArt API, museum APIs, Commons, the open web), not just one site.
  3. Curate & caption — vision‑assess candidates; motif‑diverse selection; captions tuned to style vs. subject.
  4. Optimize & package — sRGB, aspect‑preserved ≤2K, /16‑aligned, metadata stripped, numbered + captioned, zipped for fal.
  5. Train & validatefal-ai/krea-2-trainer (1000 steps, LR 5e‑4 defaults), then render previews at ~2K and look at them.
  6. Publish — Krea‑style model card with the native <Gallery />, private‑first.

The core lessons it bakes in

  • 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).

Bundled scripts (scripts/)

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.

Requirements

  • 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

Install as a Claude Code skill

git clone https://github.com/gary149/train-krea2-lora ~/.claude/skills/train-krea2-lora

Then in Claude Code: /train-krea2-lora train a <subject> lora.

Notes

  • 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.

About

Agents Skill: end-to-end Krea 2 image LoRAs with dataset research/curation → fal training → Hugging Face publish and HF publishing

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages