I built a six-stage pipeline for curating and packaging a licensed digicam dataset for a style LoRA, and decided to open source the workflow alongside the dataset. krea-2-trainer. <The pipeline reads and writes through files at each stage, ensuring reproducibility and modularity. Each stage is standalone, so it can be rerun independently or modularly combined with others. The final output is a zip file ready for training, accompanied by caption sidecars for each image and an attribution CSV. >
scrape.py harvests 640px thumbnails from Wikimedia Commons “Taken with…”
categories for eleven cameras — Nokia N95, Sony Ericsson Aino, C902, C905, and
C702, Canon PowerShot A80, A70, and A95, Sony DSC-P200 and DSC-P8, Kodak
EasyShare C743 — capped at 1,000 per category. A file is kept only if its
license is CC0, public domain, CC BY, or CC BY-SA. An EXIF date outside
2003–2010 is rejected; a missing date is kept and flagged. Each kept file is a
row in manifest.csv. Other fun usecases for this workflow include curating datasets for different camera types, eras, or licensing constraints, and experimenting with alternative ranking and captioning models.
rank.py scores those thumbnails with SigLIP 2: mean cosine similarity to six
candid, flash-lit, party-scene prompts minus mean similarity to six encyclopedic
landmark prompts. The score is a sort order, written to scores.csv.
gallery.py writes one static HTML file, sorted by that score. A click cycles
keep, reject, unmarked. Export downloads keepers.json. The committed cuts are
160 combined, 122 cameraphone, and 38 compact digicam. This involves manually reviewing and curating the images to ensure they meet the desired criteria for the dataset, but the workflow is designed to make this process as structured and reproducible as possible and it is automatable
fetch.py downloads the original for each keeper into data/fullres/, skipping
files already on disk.
caption.py asks MiniCPM-V, the model chosen at runtime through Ollama, for the literal content and forbids style, camera, and era. A caption that is too short, or one word repeated past a fixed count and fraction, is rejected. This is done via a loop that continues until a valid caption is produced or the model fails. The loop ensures that only acceptable captions are retained. A rejected or
unreachable reply falls back to Qwen3-VL, which sees a 1024×1024 copy, reloads
for every image, and starts each reply with one of six openers chosen from the
filename. Sidecars are written as content plus a trigger. The default trigger is
y2k digicam snapshot style. The reason Qwen3-VL is used as a fallback and not the primary model is to ensure is a matter of speed: MiniCPM-V is faster for the majority of cases, and Qwen3-VL is only invoked when the primary model fails to produce a satisfactory caption. Your own environment can be configured similarly, choosing the primary and fallback models based on performance and reliability considerations.
package.py will not write the zip unless every keeper has an image and a
caption sidecar. Beside the zip it writes an attribution CSV. Passing a keepers file and an output name packages one cut from the same
full-resolution pool.
Depending on where you end up training your model, you may need to create a trigger that matches the expected input format for your training pipeline. This could involve renaming the default trigger, adjusting the sidecar structure, or modifying the caption content to align with your model’s requirements. The current default trigger is y2k digicam snapshot style. There is a chance this actually leads the model to focus too narrowly on the style descriptor as a content vector rather than style itself, so careful evaluation and potential adjustment of the trigger may be necessary.
Lineage & Changelog
- Added to hnsk.site.
- Published six-script dataset pipeline repository.
- Reconciled copy with paper v6 and trimmed work page.