← 返回 Skills 市场
Lora Finetune
作者
Nissan Dookeran
· GitHub ↗
· v1.0.0
383
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install lora-finetune
功能描述
LoRA fine-tuning pipeline for Stable Diffusion on Apple Silicon — dataset prep, training, evaluation with LLM-as-judge scoring. Use when fine-tuning image ge...
使用说明 (SKILL.md)
LoRA Fine-Tuning (Apple Silicon)
Train custom LoRA adapters for Stable Diffusion 1.5 on Mac hardware. Tested on M4 24GB — produces 3.1MB weight files in ~15 minutes at 500 steps.
Hardware Requirements
| Config | Model | Resolution | VRAM |
|---|---|---|---|
| M4 24GB | SD 1.5 | 512×512 | ✅ Works |
| M4 24GB | SDXL | 512×512 | ⚠️ Tight, may OOM |
| M4 24GB | FLUX.1-schnell | Any | ❌ OOMs |
| M4 Pro 48GB | SDXL | 1024×1024 | ✅ Estimated |
Training Pipeline
- Prepare dataset: 15-25 images in consistent style, 512×512, with text captions
- Train LoRA: 500 steps, learning rate 1e-4, rank 4
- Evaluate: Generate test images, compare base vs LoRA vs reference (Gemini/DALL-E)
- Score: LLM-as-judge rates each on style consistency, quality, prompt adherence
Quick Start
# Prepare training images in a folder
ls training_data/
# image_001.png image_001.txt image_002.png image_002.txt ...
# Train (see scripts/train_lora.py for full options)
python3 scripts/train_lora.py \
--data_dir ./training_data \
--output_dir ./lora_weights \
--steps 500 \
--lr 1e-4 \
--rank 4
Evaluation with LLM-as-Judge
# Compare base model vs LoRA vs commercial (Gemini/DALL-E)
# Pixtral Large scores each image 1-10 on:
# - Style consistency with training data
# - Image quality and coherence
# - Prompt adherence
# Our results: Base 6.8 → LoRA 9.0 → Gemini 9.5
# Lesson: Gemini wins without training, but LoRA closes the gap significantly
Key Lessons
- float32 required on MPS — float16 silently produces NaN on Apple Silicon for SD pipelines
- mflux is faster than PyTorch MPS for FLUX (~105s vs ~90min) but doesn't support LoRA training
- SD 1.5 is the ceiling for 24GB — FLUX LoRA OOMs even with gradient checkpointing
- 15-25 images is the sweet spot — fewer undertrain, more doesn't help proportionally
- Gemini (Imagen 4.0) beats fine-tuned SD 1.5 with zero training — use commercial APIs for production, LoRA for experimentation and offline use
Files
scripts/train_lora.py— Training script with Apple Silicon MPS supportscripts/compare_models.py— LLM-as-judge evaluation comparing base vs LoRA vs reference
安全使用建议
This skill appears coherent for local LoRA fine-tuning. Things to consider before installing/running:
- HF_TOKEN: provide a Hugging Face token scoped appropriately (prefer read-only if possible). The token is used to download models from the Hub.
- Dependencies: you must install torch, diffusers, peft, and PIL (and any Apple Silicon-specific builds) yourself; the skill does not include an automated installer.
- LLM scoring mismatch: the README mentions an "LLM-as-judge" evaluation, but the provided scripts do not perform any LLM calls — if you expect automated scoring, you will need additional code or instructions.
- Model provenance & licensing: verify the model IDs (e.g., FLUX.1-schnell, stable-diffusion-v1-5) and their licenses before downloading or fine-tuning, especially if you will redistribute results.
- Resource use: training may be memory- and time-intensive; test with small steps and small datasets first and monitor MPS/CPU memory.
- Safety: the scripts operate on local files only and save outputs locally, but always inspect third-party model IDs and avoid supplying sensitive data in training captions.
Overall, the skill looks internally consistent and appropriate for its stated purpose, with moderate non-security caveats about missing LLM scoring and explicit dependency installation instructions.
功能分析
Type: OpenClaw Skill
Name: lora-finetune
Version: 1.0.0
The skill bundle is benign. It implements a LoRA fine-tuning pipeline for Stable Diffusion models, as described in the `SKILL.md` documentation. The skill explicitly declares its need for outbound network access to `huggingface.co` for model downloads and requires an `HF_TOKEN` environment variable, both of which are legitimate for an ML skill. The Python scripts (`scripts/train_lora.py`, `scripts/compare_models.py`) perform standard machine learning operations, including model loading, training, inference, and local file system operations for data and output. There is no evidence of data exfiltration, malicious execution, persistence mechanisms, obfuscation, or prompt injection attempts against the OpenClaw agent.
能力评估
Purpose & Capability
Name/description (LoRA fine-tuning for Stable Diffusion on Apple Silicon) match the included training and comparison scripts and the declared need for HF_TOKEN to download models. Minor inconsistency: SKILL.md discusses an "LLM-as-judge" scoring step (Pixtral/Gemini comparisons) but the included scripts do not implement any LLM calls or automated scoring — only image generation and side-by-side comparison are implemented.
Instruction Scope
SKILL.md instructs running the provided Python scripts against a local training_data folder; the scripts read only image and .txt caption files from that folder, load models from the Hub, train and save LoRA weights locally, and write logs/images to local output dirs. There are no instructions to read unrelated host files, send training data to external endpoints, or access system configuration beyond standard file I/O.
Install Mechanism
Instruction-only install (no install spec). This is low-risk because nothing is auto-downloaded or written by an installer; however the runtime requires Python packages (torch, diffusers, peft, PIL) which must be installed by the user — the skill does not provide an automated install script for those dependencies.
Credentials
The only required environment credential is HF_TOKEN (declared as primaryEnv). This is appropriate and expected for downloading models from Hugging Face Hub; the scripts do not attempt to read other environment variables or unrelated credentials. Note: the scripts rely on diffusers.from_pretrained which will use HF_TOKEN to access the Hub, so providing HF_TOKEN is necessary for private or gated models.
Persistence & Privilege
The skill is not always-enabled and does not request any elevated or persistent platform privileges. It only writes its own output files (weights, images, logs) to local directories specified by the user.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install lora-finetune - 安装完成后,直接呼叫该 Skill 的名称或使用
/lora-finetune触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release — extracted from Sandman Tales v2 hackathon
元数据
常见问题
Lora Finetune 是什么?
LoRA fine-tuning pipeline for Stable Diffusion on Apple Silicon — dataset prep, training, evaluation with LLM-as-judge scoring. Use when fine-tuning image ge... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 383 次。
如何安装 Lora Finetune?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install lora-finetune」即可一键安装,无需额外配置。
Lora Finetune 是免费的吗?
是的,Lora Finetune 完全免费(开源免费),可自由下载、安装和使用。
Lora Finetune 支持哪些平台?
Lora Finetune 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Lora Finetune?
由 Nissan Dookeran(@nissan)开发并维护,当前版本 v1.0.0。
推荐 Skills