Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Audit and repair a kohya-style LoRA dataset before training. Use when the user asks to check, validate, inspect, fix, clean, 体检, or 修 a dataset, captions, or tags. Inspect image count, repeats and step budget, resolution and aspect buckets, duplicates, corrupt or non-RGB images, missing or empty captions, trigger consistency, and tag-frequency hygiene. Return a structural PASS, WARN, or FAIL report and apply only confirmed fix_dataset.py actions, dry-run first with displaced originals quarantine
.claude/skills/rinne414-dataset-doctor/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 345% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 259% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 269% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 146% | 0% |
在训练前对 LoRA 数据集与标注做结构/卫生预检,给出 PASS / WARN / FAIL 结论和按优先级排序的修复建议;PASS 不代表图像与 caption 的语义已经人工验证。确认后用 fix_dataset.py 一行命令执行修复。体检只读;修复默认 dry-run,加 --apply 才动文件,且从不删除——被移除的文件全部进数据集内的 _quarantine/(体检与训练都会忽略它),随时可还原。任何 --apply 都必须先得到用户确认。
底层针对 lora-scripts-next(SD-Trainer)的数据集约定:train_data_dir 下放 <repeats>_<concept> 子文件夹(如 7_zkz = 重复 7 次、概念 zkz),caption 是与图同名的 sidecar .txt——单行、逗号分隔、可在末尾用「. 」接自然语言(已验证格式见 ../references/caption-guide.md)。Anima .json caption 仅是 UI 宣称的可选项,训练端 v2.7.0 未发现读取实现,不要依赖。
接收一个数据集路径,运行体检脚本,解读 JSON/报告,向用户说明问题与修复顺序;用户确认后用 fix_dataset.py 执行修复并重检。trainer 本身只检查目录是否存在、有没有图,不检查质量——质量这块由本 skill 负责,二者互补。
体检与修复是训练器无关的:检查对象是标准 kohya 数据集约定(<repeats>_<concept> 文件夹 + 同名 sidecar caption),sd-scripts / kohya_ss / OneTrainer 等训练器通用;脚本全程离线、不碰 GPU、不需要 trainer 在线。用户打算在任何训练器上练 LoRA,体检都照做。只有两处例外:
../lora-pipeline/scripts/tag_dataset.py,与完整 pipeline 保持一致;SD1.5/SDXL/Flux 可走 SD-Trainer 的 POST /api/interrogate。.json caption 校验只对已经持有 .json 标注的数据集有意义,且 .json 是否真被训练端读取未经验证(v2.7.0 本地代码中无读取实现)——doctor 默认要求 .txt;仅在明确使用会读取 JSON 的其他训练器时传 --prefer-json。有「训练前检查数据集 / caption / tag 质量」意图时触发:体检、检查数据集、看看标注、tag 有没有问题、能不能开训、trigger 一致吗、有没有重复图、步数够不够。
tag_dataset.py;其他底模走 /api/interrogate;打完再回来体检。lora-trainer;它会在开训前调用本 skill 作为闸门。../references/caption-guide.md。| 需要处理的事 | 读取 / 执行 | | --- | --- | | 跑一次完整体检(默认) | scripts/doctor.py(见「运行体检」) | | 修复体检发现的问题(dry-run → 确认 → --apply) | scripts/fix_dataset.py(见「修复手册」) | | 只看图像层面问题 | scripts/scan_dataset.py | | 只看 caption / tag 问题 | scripts/check_captions.py | | caption 格式、trigger、JSON 结构 | ../references/caption-guide.md | | 打标 / 重打标 API | ../references/trainer-api.md | | 训练参数与步数预算 | ../references/anima-params.md |
脚本依赖 Pillow(纯 stdlib + Pillow,无需 numpy)。用一个装了 Pillow 的 Python 运行——trainer 自带的 embedded Python 最稳妥:
C:\SD-Trainer\python_embeded\python.exepython(缺 Pillow 时 pip install pillow)主入口 doctor.py(同时跑 scan + caption 并给总结论):
powershell& "<PYTHON>" "<SKILL_DIR>/scripts/doctor.py" "<TRAIN_DATA_DIR>" ` --trigger <TRIGGER> --epochs <N> --batch-size <B> --target-reso 1024,1024 --json
<TRAIN_DATA_DIR>:<repeats>_<concept> 的父目录(也可直接指向某个概念子文件夹)。--trigger:预期的触发词;不给则脚本会推断一个候选。--epochs/--batch-size:用于算总步数预算(可选但推荐)。--json(机器读,含 verdict / summary / recommendations / scan / captions)、--report(人读 Markdown)、默认两者都打印。需要分别看时用 scan_dataset.py / check_captions.py,参数同名。
按 recommendations(已按严重度排序、去重)逐条处理。scan.issues / captions.issues 里每条都带 code、message、fix、items(示例文件,最多 12 个)。
fix_dataset.py 与 doctor.py 用同一个 Python 运行。所有命令默认 dry-run(只打印计划),把计划摊给用户、确认后同一条命令加 --apply 执行。被移走的文件进 <dataset>/_quarantine/,不删除。
powershell& "<PYTHON>" "<SKILL_DIR>/scripts/fix_dataset.py" <command> "<TRAIN_DATA_DIR>" [选项] [--apply]
| code | 修复命令 | | --- | --- | | no_concept_folders | fix_dataset.py organize <dir> --repeats <R> --concept <name> | | corrupt_images | fix_dataset.py quarantine-corrupt <dir> | | exact_duplicates | fix_dataset.py dedupe <dir>(保留分辨率最高的一张) | | near_duplicates | fix_dataset.py dedupe <dir> --near | | non_rgb_mode | fix_dataset.py to-rgb <dir>(原件备份进 _quarantine/) | | trigger_inconsistent | fix_dataset.py add-trigger <dir> --trigger <T>(.txt 按 Anima 分段顺序插入;.json 写 character) | | artifact_tags / duplicate_tags | fix_dataset.py strip-tags <dir>(移除 watermark/signature 等来源噪声;准确的逐图 quality 标签不是 artifact) | | multiline_caption | 训练端只读 .txt 第一行,后续行静默丢失。手动把每个 caption 合并成单行:tag 在前、. 接自然语言(格式见 ../references/caption-guide.md) | | ubiquitous_tags | 先核对哪个是有意的 trigger,其余用 strip-tags --tags "..." 删 | | missing_captions / empty_captions | Anima:tag_dataset.py --dataset-dir <concept-dir> ...;其他底模:POST /api/interrogate + additional_tags=<TRIGGER> | | below_target_resolution / tiny_images | 换更高分辨率源;bucket_no_upscale 下小图细节受限(无自动修复) | | mixed_repeats | 核对各概念「有效图片数」比例是否符合预期(无需修复) |
打标 / 修复后,重新跑一次 doctor.py 确认问题已清。误修了想还原 → 把 _quarantine/ 里的文件移回原位即可。
train_data_dir(<repeats>_<concept> 的父目录),不是散图目录;散图会触发 no_concept_folders。--trigger,并核对 trigger.presence_pct;Anima trigger 按分段顺序出现,不强制首位。verdict 并按 recommendations 顺序给建议。fix_dataset.py --apply / 打标操作已先 dry-run 摊牌并取得用户确认;从不手写删除命令,从不直接删文件(一律走 _quarantine/)。用户:训练前帮我看看 D:/data/mychar(trigger 是 mych4r,打算 10 epoch)。
powershell& "C:\SD-Trainer\python_embeded\python.exe" ` "<SKILL_DIR>/scripts/doctor.py" "D:/data/mychar" --trigger mych4r --epochs 10 --report
读 verdict:若 WARN 且 missing_captions+exact_duplicates,则:① Anima 用 tag_dataset.py 给缺标的图打标并生成语义审查;② fix_dataset.py dedupe "D:/data/mychar" dry-run 列出重复组 → 用户确认 → 加 --apply(被移除的进 _quarantine/);③ 修完重跑体检;④ PASS 或用户明确接受剩余 WARN 后,把数据集 + 建议的 repeats/epochs 交给 lora-trainer。
POST /api/run、监看 SSE log 交给 lora-trainer。../references/trainer-api.md;caption 写法见 ../references/caption-guide.md。--apply、移除走 _quarantine/ 不删除。| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 15,061 | 7,173 | -52% | 1 | 1 | 0% | 2,896 | 3,070 | +6% | 0 | 0 | — |
case-02 | fail→pass | 8,299 | 10,905 | +31% | 1 | 1 | 0% | 899 | 4,000 | +345% | 0 | 0 | — |
case-03 | fail→pass | 5,582 | 8,159 | +46% | 1 | 1 | 0% | 953 | 3,425 | +259% | 0 | 0 | — |
case-04 | fail→pass | 5,626 | 4,567 | -19% | 1 | 1 | 0% | 927 | 3,419 | +269% | 0 | 0 | — |
case-05 | fail→pass | 9,530 | 8,152 | -14% | 1 | 1 | 0% | 1,680 | 4,138 | +146% | 0 | 0 | — |
case-06 | fail→pass | 13,234 | 7,040 | -47% | 1 | 1 | 0% | 2,243 | 3,694 | +65% | 0 | 0 | — |
case-07 | pass→pass | 10,812 | 6,339 | -41% | 1 | 1 | 0% | 1,754 | 3,819 | +118% | 0 | 0 | — |
case-08 | fail→pass | 15,830 | 5,472 | -65% | 1 | 1 | 0% | 3,101 | 3,743 | +21% | 0 | 0 | — |
case-09 | fail→pass | 14,149 | 10,082 | -29% | 1 | 1 | 0% | 2,436 | 4,200 | +72% | 0 | 0 | — |
case-10 | fail→pass | 12,165 | 5,013 | -59% | 1 | 1 | 0% | 1,970 | 3,462 | +76% | 0 | 0 | — |
case-11 | fail→pass | 6,593 | 6,760 | +3% | 1 | 1 | 0% | 1,228 | 3,571 | +191% | 0 | 0 | — |
case-12 | fail→pass | 10,994 | 6,719 | -39% | 1 | 1 | 0% | 1,947 | 3,782 | +94% | 0 | 0 | — |
case-13 | pass→pass | 5,504 | 3,758 | -32% | 1 | 1 | 0% | 907 | 3,248 | +258% | 0 | 0 | — |
case-14 | pass→pass | 8,588 | 5,956 | -31% | 1 | 1 | 0% | 1,542 | 3,679 | +139% | 0 | 0 | — |
case-15 | fail→pass | 8,217 | 5,974 | -27% | 1 | 1 | 0% | 1,329 | 3,650 | +175% | 0 | 0 | — |
case-16 | pass→pass | 11,920 | 8,472 | -29% | 1 | 1 | 0% | 2,155 | 4,168 | +93% | 0 | 0 | — |
case-17 | fail→pass | 8,948 | 3,705 | -59% | 1 | 1 | 0% | 1,609 | 3,318 | +106% | 0 | 0 | — |
case-18 | fail→fail | 9,810 | 7,371 | -25% | 1 | 1 | 0% | 1,790 | 3,017 | +69% | 0 | 0 | — |
case-19 | fail→pass | 5,436 | 3,746 | -31% | 1 | 1 | 0% | 1,046 | 3,235 | +209% | 0 | 0 | — |
case-20 | fail→pass | 5,257 | 5,654 | +8% | 1 | 1 | 0% | 971 | 3,583 | +269% | 0 | 0 | — |
case-21 | fail→pass | 7,620 | 6,416 | -16% | 1 | 1 | 0% | 1,556 | 3,757 | +141% | 0 | 0 | — |
case-22 | fail→pass | 6,896 | 6,764 | -2% | 1 | 1 | 0% | 1,282 | 3,858 | +201% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +77 percentage points is the difference between those two pass rates over the 21 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.