LoRA Pipeline
Orchestrates the full LoRA dataset-to-model pipeline. Each phase is self-contained and can be delegated to a sub-agent independently.
Pipeline Overview
CODEBLOCK0
Phase Index
| Phase | File | Can Sub-Agent | Model | Est. Time |
|---|
| 01 — Reference Collection | INLINECODE0 | ✅ | Haiku (Worker) | 5–10 min |
| 02 — Scraping |
phases/02-scraping.md | ✅ | Haiku (Worker) | 10–30 min |
| 03 — Verify & Clean |
phases/03-verify.md | ✅ | Haiku (Worker) | 2–5 min |
| 04 — Caption |
phases/04-caption.md | ✅ | Haiku (Worker) | 1–3 min |
| 05 — Training |
phases/05-training.md | ✅ | Haiku (Worker) + Sentry | 15–30 min |
To load a specific phase: read skills/lora-pipeline/phases/<phase-file> — each file is independently readable.
Directory Structure
CODEBLOCK1
Privacy Rules (CRITICAL — All Phases)
- - NO DATA INSPECTION: Do NOT
cat, read, or analyze image file contents or .txt caption files. - NO CLOUD UPLOAD: All face verification (DeepFace) must run locally. Never send images to cloud APIs.
- NO DATA LEAKAGE: Do not describe dataset details (person names, attributes) to the LLM unnecessarily.
- Treat datasets as opaque binary blobs except when running local scripts.
Quality Standards (SDXL)
- - Resolution: 1024×1024 minimum after crop
- Format: Convert all to PNG before training
- No black borders: Run autocrop before final save
- Dataset diversity: ≥30% clothed/natural skin shots
Scripts
| Script | Location | Purpose |
|---|
| INLINECODE9 | INLINECODE10 | Local WD14 ONNX tagger for a directory |
| INLINECODE11 |
skills/lora-pipeline/scripts/smart_crop.py | Interactive or automated single-subject cropping |
|
batch_lora_train.py |
skills/lora-pipeline/scripts/batch_lora_train.py | Kohya batch training runner for RunPod |
Sub-Agent Protocol
Each phase file contains:
- 1. Input Contract — what must already exist before this phase starts
- Output Contract — what this phase produces
- Completion Signal — how to report back (
sessions_send + status file fallback) - Error Escalation — sub-agent reports to parent, never self-escalates model tier
LoRA 流水线
编排完整的 LoRA 数据集到模型流水线。每个阶段都是独立的,可以单独委托给子代理执行。
流水线概览
阶段 1: 收集示例照片 → 收集 3–6 张参考人脸照片
阶段 2: 确认人脸正确 → 用户确认参考照片;DeepFace 交叉验证
阶段 3: 收集数据集 → 根据人脸特征从网络来源抓取
阶段 4: 确认照片正确 → 人脸验证 + 去重 + 质量过滤 + 裁剪
阶段 5: 开始标注 → WD14 本地标注 + 触发词
阶段 6: LoRA 训练 → RunPod Kohya 训练 → 获取输出
阶段索引
| 阶段 | 文件 | 可委托子代理 | 模型 | 预计时间 |
|---|
| 01 — 参考照片收集 | phases/01-reference.md | ✅ | Haiku (工作节点) | 5–10 分钟 |
| 02 — 数据抓取 |
phases/02-scraping.md | ✅ | Haiku (工作节点) | 10–30 分钟 |
| 03 — 验证与清理 | phases/03-verify.md | ✅ | Haiku (工作节点) | 2–5 分钟 |
| 04 — 标注 | phases/04-caption.md | ✅ | Haiku (工作节点) | 1–3 分钟 |
| 05 — 训练 | phases/05-training.md | ✅ | Haiku (工作节点) + Sentry | 15–30 分钟 |
加载特定阶段: 读取 skills/lora-pipeline/phases/<阶段文件> — 每个文件均可独立读取。
目录结构
~/.openclaw/workspace/
└── datasets/
├── face_references/
│ └── / # 阶段 1–2:黄金标准参考照片(3–6 张)
│ ├── ref_01.jpg
│ └── ...
├── name>raw/ # 阶段 3:原始抓取图像(验证前)
│ └── ...
└── / # 阶段 4–5:验证并标注后的训练集
├── image001.png
├── image001.txt
└── ...
隐私规则(关键 — 所有阶段)
- - 禁止数据检查:不得 cat、read 或分析图像文件内容或 .txt 标注文件。
- 禁止云端上传:所有人脸验证(DeepFace)必须在本地运行。切勿将图像发送到云端 API。
- 禁止数据泄露:不得向 LLM 不必要地描述数据集细节(人名、属性)。
- 除非运行本地脚本,否则将数据集视为不透明的二进制数据块。
质量标准(SDXL)
- - 分辨率: 裁剪后最低 1024×1024
- 格式: 训练前全部转换为 PNG
- 无黑边: 最终保存前运行自动裁剪
- 数据集多样性: ≥30% 为穿着衣物/自然皮肤照片
脚本
| 脚本 | 位置 | 用途 |
|---|
| tagbatch.py | skills/lora-pipeline/scripts/tagbatch.py | 本地 WD14 ONNX 标注器,用于目录 |
| smartcrop.py |
skills/lora-pipeline/scripts/smartcrop.py | 交互式或自动化的单主体裁剪 |
| batch
loratrain.py | skills/lora-pipeline/scripts/batch
loratrain.py | 用于 RunPod 的 Kohya 批量训练运行器 |
子代理协议
每个阶段文件包含:
- 1. 输入契约 — 本阶段开始前必须已存在的内容
- 输出契约 — 本阶段产生的内容
- 完成信号 — 如何报告回执(sessions_send + 状态文件回退)
- 错误升级 — 子代理向父代理报告,从不自行升级模型层级