开源项目解析
kohya sd-scripts
训练脚本集:覆盖 SD1.x/2.x、SDXL、SD3/3.5、FLUX.1;2026-10-18 的 v0.12.1 新增 MOSS-Image LoRA 支持。
图片 LoRA 的事实标准参数命名一脉相承
读懂层
2 张 · 架构图 / 时序图
DeepWiki 架构页 · 抓取 2026-08-16 · 核验 2026-08-16
DeepWiki 架构页 · 抓取 2026-08-16 · 核验 2026-08-16
它管哪几个决定
角色跨镜头一致角色参考 · 多参考 · LoRA
7/10 家有官方说法画面构图线稿 / 姿势 / 深度约束
自持能力
权重在不在本地可下载到本地
种子能不能填可填
换掉它要动几处几处
产出的 LoRA 是你自己的权重文件,谁也收不回去
动手层
文档代码结构 未做踩过的坑实测 未做
装它要过哪几关
- 1克隆 + 虚拟环境PyTorch 2.6.0 起步
- 2accelerate config这一步必须做,要按仓库给的答案选 CUDA 与 fp16/bf16
- 3准备数据集训 LoRA 的成败大半在数据集,不在参数
改哪个文件能改什么
训练脚本选型LoRA / DreamBooth / 原生微调 / 文本反演 —— 目标不同脚本不同,别都用 LoRA 硬套底模SD1.5 / SDXL / SD3.5 / FLUX 各有对应脚本与参数坑在哪一处
带 issue 编号的来自:github issues 按回复数排序 · 核验 2026-08-16
v0.12.1 调度器参数当前 README 说明自定义学习率调度器现在收到实际 num_training_steps 与 num_warmup_steps;旧配置的行为应重新核对。
最低显存仓库不给这个数字。 这一格是空的,只能自己试 —— 与推理侧那些明写门槛的项目不是一个成熟度
训练 vs 推理本专项六个项目的训练侧 issue 都比推理侧多且久悬。推理门槛低不代表微调门槛低,这是通例不是个例
教程
没找到官方口径的教程 —— 官方只给了 README。
项目自述
以下是仓库 README 的开头部分(原文引用,抓取 2026-08-17)。读全文 ↗
sd-scripts
English / 日本語
Table of Contents
Click to expand
- Introduction
- Supported Models
- Features
- Sponsors
- Support the Project
- Documentation
- Training Documentation (English and Japanese)
- Other Documentation (English and Japanese)
- For Developers Using AI Coding Agents
- Windows Installation
- Windows Required Dependencies
- Installation Steps
- About requirements.txt and PyTorch
- xformers installation (optional)
- Linux/WSL2 Installation
- DeepSpeed installation (experimental, Linux or WSL2 only)
- Upgrade
- Upgrade PyTorch
- Credits
- License
Introduction
This repository contains training, generation and utility scripts for Stable Diffusion and other image generation models.
Sponsors
We are grateful to the following companies for their generous sponsorship:
Support the Project
If you find this project helpful, please consider supporting its development via GitHub Sponsors. Your support is greatly appreciated!
Change History
- Version 0.12.1 (2026-10-18):
- Added support for LoRA training of MOSS-Image (OpenMOSS), a 5B DiT with the Qwen3.5-9B text encoder and the FLUX.2 VAE. PR #2458, PR #2459, PR #2460, PR #2461
- moss_image_train_network.py trains LoRA (and LoHa / LoKr) for the DiT and optionally for the text encoder. The official diffusers-format shards and the ComfyUI single-file checkpoints can be loaded. For details, please refer to the documentation.
- ConvRot INT8 quantization of the base weights (--convrot_int8 for the DiT, --convrot_int8_text_encoder for the text encoder, ported from Musubi Tuner) is available as an alternative to fp8. The ComfyUI pre-quantized *_int8_convrot.safetensors files are detected automatically. The fused int8 kernels require triton (triton-windows on Windows).
- The DiT LoRA can be used in ComfyUI without conversion. moss_image_minimal_inference.py is also available for inference with LoRA.
- tools/cache_latents.py and tools/cache_text_encoder_outputs.py support MOSS-Image with --moss_image.
- The LoRA module is the new generic networks.lora_generic (regex-based module selection, network_reg_dims / network_reg_lrs, the same as networks.lora_anima). It is expected to be the base for other architectures in the future.
- Added enable_multiline_caption subset option (--enable_multiline_caption) to use captions containing line breaks as they are, for models with LLM-based text encoders (Anima, Lumina, HunyuanImage, etc.).
- Lines starting with multiline_caption_separator (default ---===---) separate multiple caption candidates for one image, and one candidate is chosen randomly at each step. In metadata files for fine tuning, caption can also be a list of strings. For details, please refer to the dataset config documentation.
- In .txt sample prompt files, \n (backslash + n) is now converted to a line break.
- Fixed caption_prefix / caption_suffix being added only to the first / last line of multi-line captions (with enable_wildcard, the prefix was attached only to the first line and the suffix only to the last line; without it, the suffix was lost).
- Fixed c
……(后略,见原文)判断
优势
- 训出来的 LoRA 是一个属于你的权重文件 —— 本专项唯一能产出「自有资产」的项目
- 2026-10-18 发布 v0.12.1,新增模型训练支持并修正学习率调度参数。
- 一套脚本覆盖 SD1.5 到 FLUX,换底模不换工具链
局限
- 仓库不给最低显存 —— 能不能训得看你自己试
- v0.12.1 调整自定义学习率调度器收到的训练与预热步数,升级后应核对自己的训练配置。
- 训练这条路的坑普遍比推理多(本专项六个项目的训练侧 issue 都久悬)
不适用
只做几条片子的人 —— 训一个 LoRA 的时间够生成几十条视频了。
同管这些决定的其它项目
ComfyUI节点式工作流底座。图像 / 视频 / 音频 / 3D / 文本共用一个底座。…MiniMax H3全模态生成:文字、图片、视频、音频进同一个 Transformer,出带 32kHz…ControlNet给扩散模型加条件控制。九种结构信号:Canny 边缘、直线、HED 边界、涂鸦、人体…IP-Adapter用图片当提示词,锁住风格或人物。仅 22M 参数。…InstantID一张脸照做身份保持生成,零样本、免调优。…musubi-tuner视频模型的 LoRA 训练器。同一套代码训 Wan 2.1/2.2、HunyuanV…DiffSynth-Studio魔搭扩散模型工程框架,覆盖图像、视频、音乐推理与训练;近期加入 FLUX.3、MOS…火宝短剧基于 AI 的一站式短剧生成平台,从剧本到成片全自动化。…ToonflowAI 创作平台:无限画布、AI Agent、可视化工作流,支持图像、视频、分镜和短剧…infinite-canvas面向 AI 创作的无限画布工作台:生图、参考图编辑、视频生成、Agent 助手、画布…open-ai-canvas面向 AI 影视创作的无限画布:多模态生成、分镜编排、素材管理、Agent 工作流。…VOZEB PRO把统一创作 Agent、画布、短剧生产线、素材库和商业运营后台放进同一套 Next.…OpenMontage让 Agent 编排视频生产:通过声明式流水线组织素材、生成、字幕、音频与合成。…Generative Media Skills给 Agent(Claude Code / Cursor / Gemini CLI)…motion-skills动效技能索引:55 个技能分成 18 个安装包,覆盖短视频、数据动画、网页动效、3D…ComfyUI-ManagerComfyUI 的节点管理器:装节点、装模型、修依赖、查注册表。ComfyUI 生态…ComfyUI-WanVideoWrapper把 Wan 系列模型接进 ComfyUI 的节点包。社区里跑 Wan 的事实标准封装…ComfyUI 官方工作流模板ComfyUI 内置的那批官方工作流模板与子图蓝图的真身仓库。…waoowaoo把一部小说灌进去,自动拆角色、拆场景、出分镜,再合成整集短剧。中英双界面。…JellyfishAI 短剧的端到端工作台:从剧本进,到分镜、角色一致性管理、出片、导出。…魔因漫创桌面端 AI 影视工具(Electron):剧本 → 角色 → 场景 → 导演 → …BigBanana AI Director一站式 AI 短剧 / 漫剧工作台,四阶段:剧本 → 视觉资产 → 分镜制作 → 导…ClipForge带货短视频专用的一站式工具:上传商品图,自动提炼卖点、写种草脚本、配音配字幕加背景乐…Open AI UGC生成 UGC 风格的口播广告:用多个视频模型出真人感的 AI 演员念你的脚本。定位是…LiveTalking实时交互流式数字人引擎,音视频同步对话。支持 ernerf、musetalk、wav…Drama Skills面向编剧与漫剧工作室的短剧创作流水线:十个技能把一个点子或一部长篇材料,一路做成分集…AI Shortfilm Prompts一个 Claude Code 技能:把任意一个想法变成电影语言的、模型直接能用的视频…Awesome Seedance 2 Prompts整理好的 Seedance 2.0 视频提示词库,README 自述逾六千条,覆盖电…歸藏的提示词库中文 AI 圈里流传最广的个人提示词仓库之一,存放作者为各家模型撰写的提示词。…MidJourney 风格与关键词参考一份带示例图的风格与关键词对照表:同一个提示词加不同风格词,画面变成什么样,逐个列出…AI Visual Prompt Cookbook171 套结构化提示词风格、342 张预览;JSON 模板支持 v2.1 / v2.…
github README · 核验 2026-10-19 | 判断栏可报错。