返回顶部
l

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 generation models for consistent style, custom characters, or domain-specific visuals. Requires Python with torch and diffusers.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
334
下载量
0
收藏
概述
安装方式
版本历史

lora-finetune

# 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 1. **Prepare dataset:** 15-25 images in consistent style, 512×512, with text captions 2. **Train LoRA:** 500 steps, learning rate 1e-4, rank 4 3. **Evaluate:** Generate test images, compare base vs LoRA vs reference (Gemini/DALL-E) 4. **Score:** LLM-as-judge rates each on style consistency, quality, prompt adherence ## Quick Start ```bash # 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 ```python # 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 support - `scripts/compare_models.py` — LLM-as-judge evaluation comparing base vs LoRA vs reference

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 lora-finetune-1776284992 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 lora-finetune-1776284992 技能

通过命令行安装

skillhub install lora-finetune-1776284992

下载 Zip 包

⬇ 下载 lora-finetune v1.0.0

文件大小: 5.27 KB | 发布时间: 2026-4-16 17:29

v1.0.0 最新 2026-4-16 17:29
Initial release — extracted from Sandman Tales v2 hackathon

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部