LoRAと遊ぶ
方針
✅まずAUTOのLoraを触る
(不実行)学習が必要なら
AUTOのDreamBoothで実行するsd-scriptsのDreamBoothで学習する
✅kohya-ssのキャプションベースの手法を実行して確認する
気づき
trigger word
weights are different
やり方調べる
added details in wiki 1/26
しかしAUTOのLoRAサポート(Not dreamboothサポート)ではtrainingにはkohya-ssのscriptsが推奨されている
A good way to train Lora is to use kohya-ss.
> WebUI等で画像生成する場合には、学習したLoRAのモデルを学習元のStable Diffusionのモデルにこのリポジトリ内のスクリプトであらかじめマージしておくか、こちらのWebUI用extensionを使ってください。
how to use
2022年12月9日には DreamBoothのextensionで実装されている
拡張機能としても存在してる(違いは何?)
>This extension is for AUTOMATIC1111's Stable Diffusion web UI, allows the Web UI to add some networks (e.g. LoRA) to the original Stable Diffusion model to generate images.
つまりこの人のscriptを使ってLoRAを学習させて、それを利用することができる拡張ということ

ではLoRAをどう学習させるのか?
sd-scriptsでは学習方法は2種類提供されている
どっちがいいの?

identifier(sksなど)とclass、オプションで正則化画像を用いる
NAIの提案ベースの手法
キャプションを用いる
自動キャプションニング
タグ付け
>Diffusersを用いてStable DiffusionのU-Netのfine tuningを行います。NovelAIの記事にある以下の改善に対応しています(Aspect Ratio BucketingについてはNovelAIのコードを参考にしましたが、最終的なコードはすべてオリジナルです)。
>デフォルトではAuto Encoderの学習は行いません。モデル全体のfine tuningではU-Netだけを学習するのが一般的なようです(NovelAIもそのようです)。オプション指定でText Encoderも学習対象とできます。
example
>A method to fine tune weights for CLIP and Unet, the language model and the actual image de-noiser used by Stable Diffusion, published in 2021. Paper. A good way to train Lora is to use kohya-ss.
> Support for Lora is built-in into the Web UI, but there is an extension with original implementation by kohyaa-ss.
> Currently, Lora networks for Stable Diffusion 2.0+ models are not supported by Web UI.
> Lora is added to the prompt by putting the following text into any location: <lora:filename:multiplier>, where filename is the name of file with Lora on disk, excluding extension, and multiplier is a number, generally from 0 to 1, that lets you choose how strongly Lora will affect the output. Lora cannot be added to the negative prompt.
> The text for adding Lora to the prompt, <lora:filename:multiplier>, is only used to enable Lora, and is erased from prompt afterwards, so you can't do tricks with prompt editing like [<lora:one:1.0>|<lora:two:1.0>]
. A batch with multiple different prompts will only use the Lora from the first prompt.