A newer version of the Gradio SDK is available:
5.13.1
[ èªè ã«ãªã ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://blog.hatena.ne.jp/hoshikat/hoshikat.hatenablog.com/subscribe?utm_medium%3Dbutton%26utm_source%3Dblogs_topright_button%26utm_campaign%3Dsubscribe_blog)
[人工ç¥èœãšèŠªãããªãããã°](https://hoshikat-hatenablog-
com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp)
人工ç¥èœã«é¢ãããããã¯ãåãäžããããã°ã§ã
[ 2023-05-26 ](https://hoshikat-hatenablog- com.translate.goog/archive/2023/05/26?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
[誰ã§ããããStable Diffusion Kohya_ssã䜿ã£ãLoRAåŠç¿èšå®ã培åºè§£èª¬](https://hoshikat-
hatenablog- com.translate.goog/entry/2023/05/26/223229?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
ååã®èšäºã§ã¯ãStable Diffusionã¢ãã«ãè¿œå åŠç¿ããããã®WebUIç°å¢ãkohya_ssãã®å°å ¥æ³ã«ã€ããŠè§£èª¬ããŸããã
ä»åã¯ãLoRAã®ããã¿ã倧ãŸãã«èª¬æãããã®åŸã«kohya_ssã䜿ã£ãLoRAåŠç¿èšå®ã«ã€ããŠè§£èª¬ããŠãããŸãã
â»ä»åã®èšäºã¯éåžžã«é·ãã§ãïŒ
ãã®èšäºã§ã¯ãåèšå®ã®æå³ãã®ã¿è§£èª¬ããŠããŸãã
ãåŠç¿ç»åã®çšæã®ãããããšããç»åã«ã©ããã£ãã·ã§ã³ãã€ãããããšããã©ãåŠç¿ãå®è¡ããããã¯è§£èª¬ããŠããŸãããåŠç¿ã®å®è¡æ³ã«ã€ããŠã¯ãŸãå¥ã®èšäºã§è§£èª¬ããããšæããŸãã
- LoRAã®ä»çµã¿ãç¥ãã
- kohya_ssãç«ã¡äžããŠã¿ãã
- LoRAåŠç¿ã®åèšå®
- LoRAèšå®ã®ã»ãŒããããŒã
- Source modelã¿ãïŒ åŠç¿ã«äœ¿ãããŒã¹ã¢ãã«ã®èšå®
- Foldersã¿ãïŒ åŠç¿ç»åã®å ŽæãšLoRAåºåå ã®èšå®
- Training parametersã¿ãïŒ åŠç¿ã®è©³çŽ°èšå®
- LoRA type
- LoRA network weights
- DIM from weights
- Train batch size
- Epoch
- Save every N epochs
- Caption Extension
- Mixed precision
- Save precision
- Number of CPU threads per core
- Seed
- Cache latents
- Cache latents to disk
- Learning rate:
- LR Scheduler:
- LR warmup
- Optimizer
- Optimizer extra arguments
- Text Encoder learning rate
- Unet learning rate
- Network Rank(Dimension)
- Network alpha:
- Max resolution
- Stop text encoder training
- Enable buckets
- Advanced Configuration
- WeightsãBlocksãConv
- Weights: Down LR weights/Mid LR weights/Up LR weights
- Weights: Blocks LR zero threshold
- Blocks: Block dims, Block alphas
- Conv: Conv dims, Conv, alphas
- No token padding
- Gradient accumulation steps
- Weighted captions
- Prior loss weight
- LR number of cycles
- LR power
- Additional parameters
- Save every N steps
- Save last N steps
- Keep n tokens
- Clip skip
- Max Token Length
- Full fp16 training (experimental)
- Gradient checkpointing
- Shuffle caption
- Persistent data loader
- Memory efficient attention
- Use xformers
- Color augmentation
- Flip augmentation
- Min SNR gamma
- Don't upscale bucket resolution
- Bucket resolution steps
- Random crop instead of center crop
- Noise offset type
- Noise offset
- Adaptive noise scale
- Multires noise iterations
- Multires noise discount
- Dropout caption every n epochs
- Rate of caption dropout
- VAE batch size
- Save training state
- Resume from saved training state
- Max train epoch
- Max num workers for DataLoader
- WANDB API Key
- WANDB Logging
- Sample images config
- ãŸãšã
LoRAã®ä»çµã¿ãç¥ãã
kohya_ssã®åèšå®ã®æå³ãç¥ãã«ã¯ãLoRAãã©ãããã¡[ã«ã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25AB%25A5%25CB)ãºã ã§è¿œå åŠç¿ãããã®ãç¥ã£ãŠããå¿ èŠããããŸãã
è¿œå åŠç¿ã®å¯Ÿè±¡ã§ãããã¢ãã«ããšã¯äœãªã®ããåãããŠèª¬æããŸãã
ãã¢ãã«ããšã¯
Stable Diffusionã¯ã ã¢ãã« ããšåŒã°ããã¢ãžã¥ãŒã«ãèªã¿èŸŒãã§äœ¿ããŸããã¢ãã«ãšã¯ããã°ãè³ã¿ããã§ããã®æ£äœã¯ã [ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®ãŠã§ã€ãæ å ±ãã§ãã
[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã¯ããããã®ã [ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3) ãããã§ããŠããŠã[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)ã®ãŸãšãŸããäœå±€ãã®ã ã¬ã€ã€ãŒ ãã圢äœã£ãŠããŸããããã¬ã€ã€ãŒã®[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)ã¯éãã¬ã€ã€ãŒã®[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)ãšç·ã§ã€ãªãã£ãŠããŠããã®ã€ãªããã®åŒ·ããè¡šãã®ãã ãŠã§ã€ã ãã§ããèšå€§ãªçµµã®æ å ±ãä¿æããŠããã®ã¯ããã®ããŠã§ã€ãããªã®ã§ãã
LoRAã¯å°ãã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ãã
LoRAã¯ãè¿œå åŠç¿ãã®äžçš®ã§ãããè¿œå åŠç¿ãšã¯[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãããŒãžã§ã³ã¢ããããããšã§ãã
ãã®æ¹æ³ã¯ãããããããŸããããŸãæãã€ãã®ã¯äžã®å³ã®ããã«ã¢ãã«å šéšãåŠç¿ããªããæ¹æ³ã§ãã
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230512/20230512000033.png)
è¿œå åŠç¿ã§ã¢ãã«ãéããªãã
ãDreamBoothããšããè¿œå åŠç¿æ³ããã®æ¹æ³ã䜿ã£ãŠããŸãã
ãã®æ¹æ³ã ãšãããè¿œå åŠç¿ããŒã¿ãå ¬éãããå Žåãè¿œå åŠç¿ã§æ°ãããªã£ãã¢ãã«ãäžžããšé åžããå¿ èŠããããŸãã
ã¢ãã«ã®ãµã€ãºã¯éåžž2Gïœ5Gãã€ããããé åžã¯ãªããªã倧å€ã§ãã
ããã«å¯ŸããŠãLoRAåŠç¿ã§ã¯ã¢ãã«ã«ã¯æãä»ãããæ°ãããå°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ããåŠç¿ãããäœçœ®ããšã«äœããŸããè¿œå åŠç¿ã¯ããã®å°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã察象ã«ããŠè¡ãããŸãã
LoRAãé åžããããšãã¯ãã®å°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã ããé åžããã°ããã®ã§ãããŒã¿ãµã€ãºãå°ãªãæžã¿ãŸãã
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230512/20230512005959.png)
RoLAåŠç¿ã¯å°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)察象
å°ãã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en-
US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®æ§é
LoRAã®å°ãã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã¯ïŒã€ã®å±€ããã§ããŠããŸããå·Šã®ãå ¥åå±€ããå³ã®ãåºåå±€ãã®[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)ã®æ°ã¯ãã¿ãŒã²ããã®[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®ãå ¥åå±€ããåºåå±€ãã®[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)æ°ãšåãã§ããçãäžã®å±€(äžéå±€)ã®[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)æ°ã¯ãã©ã³ã¯æ°ã(ãŸãã¯æ¬¡å æ°)ãšåŒã°ãããã®æ°ã¯åŠç¿ãããšãã«èªç±ã«æ±ºããããšãã§ããŸãã
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230512/20230512011058.png)
å°ããª[ãã¥ãŒã©ã«ãããã¯ãŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8%25A5%25EF%25A1%25BC%25A5%25AF)ã®æ§é
ã§ã¯ããã®å°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã¯ã©ãã«è¿œå ãããã®ã§ãããïŒ
LoRAåŠç¿å¯Ÿè±¡1ïŒU-Net
äžã®å³ã¯Stable Diffusionã®å¿èéšã§ãããU-Netããšããã¡[ã«ã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25AB%25A5%25CB)ãºã ã§ãã
U-Netã¯ãDownã(å·Šåå)ãMidãïŒäžçªäžïŒãUpãïŒå³ååïŒã«åããããŸãã
ãããŠãDown12ãããã¯ãMid1ãããã¯ãUp12ãããã¯ã®åèš25ãããã¯ããã§ããŠããŸãã
ããã®äžã®èµ€ãç¢å°ã®éšå(ãªã¬ã³ãžè²ã®ãããã¯)ãLoRAåŠç¿å¯Ÿè±¡ã§ããã€ãŸãããã®èµ€ãç¢å°ã®ãããã¯ã«å°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ãããŸãã
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230512/20230512011350.png)
èµ€ãç¢å°ã®ãããã¯ãLoRAåŠç¿å¯Ÿè±¡ã®ãAttentionãããã¯ã
ãªã¬ã³ãžè²ã®ãããã¯ã§ã¯ãããã¹ãåŠçããã€ãŸãããã³ãããšããŠäžããããããã¹ããç»åã«åæ ãããåŠçãè¡ã£ãŠããŸãã
ãã®ãããã¯ãããã«çŽ°ããèŠããšã以äžã®ãããªåŠçãè¡ã£ãŠããŸãã
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230512/20230512011718.png)
èµ€ãç¢å°ã®éšåã«ããããå°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ããã
ããã«ãèµ€ãç¢å°ãããã€ãã€ããŠããŸããããã®èµ€ãç¢å°ã®åŠçå šéšã«ããããå¥ã®[ãã¥ãŒã©ã«ãããã¯ãŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8%25A5%25EF%25A1%25BC%25A5%25AF)ãè¿œå ãããŸãã
ããã«è¿œå ããã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®ããšãKohya_ssã§ã¯åçŽã«ãUNetããšåŒãã§ããŸãã
RoLAåŠç¿å¯Ÿè±¡2ïŒããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)
LoRAã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ããã®ã¯ããã ãã§ã¯ãããŸããã
äžã®å³ã®ãCross Attentionããšãããããã¯ã¯ããããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ããšããã¢ãžã¥ãŒã«ããããã¹ãæ å ±ãåãåããŸãããã®ãããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ãã¯ãããã¹ãããŒã¿ã§ããããã³ãããæ°åã®å(ãã¯ãã«)ã«å€æãããšãã圹å²ããããŸãã
ããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã¯1ã€ãããªããU-Netå ã®ãã¹ãŠã®Attentionãããã¯ã§å ±éã§äœ¿ãããŸãããã®ããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã¯æ¬æ¥Stable Diffusionå ã§ã¯ãå®æåããšããŠæ±ãããã¢ãã«åŠç¿ã®å¯Ÿè±¡ã«ã¯ãªããŸããããLoRAã«ããè¿œå åŠç¿ã§ã¯ãããåŠç¿å¯Ÿè±¡ã§ãã
LoRAã§ã¢ããããŒãããããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã¯ãã¹ãŠã®Attentionãããã¯ã§äœ¿ãããã®ã§ãããã«è¿œå ããã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã¯å®æç»åã«ãšãŠã倧ããªåœ±é¿ãåãŒããŸãã
ããã«è¿œå ããã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®äºãKohya_ssã§ã¯ãText EncoderããšåŒãã§ããŸãã
kohya_ssãç«ã¡äžããŠã¿ãã
LoRAåŠç¿ã®ããã¿ãèŠãã®ã§ãããããkohya_ssã䜿ã£ãŠã¿ãŸãããã
kohya_ssãã©ã«ãå ã«ããã[gui](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/gui).batããããã«ã¯ãªãã¯ãããšã[ã³ãã³ãããã³ãã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25B3%25A5%25DE%25A5%25F3%25A5%25C9%25A5%25D7%25A5%25ED%25A5%25F3%25A5%25D7%25A5%25C8)(é»èæ¯ã®æåã ãã®ãŠã£ã³ããŠ)ãç«ã¡äžãããŸãããã°ãããããšããã«URLã衚瀺ãããã®ã§ãããããŠã§ããã©ãŠã¶ã®URLæ¬ã«å ¥åããŠãªã¿ãŒã³ãæŒããškohya_ssã®ç»é¢ããã©ãŠã¶äžã«è¡šç€ºãããŸãã
kohya_ssãç«ã¡äžãããšãUIã®äžéšã«ã¿ããããã€ãçŸããŸãããã®äžã®ãDreambooth LoRAããéžã³ãŸãããããããLoRAåŠç¿ã®ããã®ã¿ãã§ãã
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230518/20230518004131.png)
å·Šãã2çªç®ã®ã¿ããLoRAåŠç¿èšå®
LoRAåŠç¿ã®åèšå®
ãDreambooth LoRAãã¿ããéžã¶ãšãããããã®èšå®ãåºãŠããŸããããããããã§è§£èª¬ããŸãã
LoRAèšå®ã®ã»ãŒããããŒã
äžçªäžã«ããã®ã¯ãã³ã³ãã£ã°ãã¡ã€ã«ãã§ããããã§LoRAèšå®ãã³ã³ãã£ã°ãã¡ã€ã«ãšããŠã»ãŒããããŒãããããšãã§ããŸãã
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230518/20230518004415.png)
èšå®ã¯ã³ã³ãã£ã°ãã¡ã€ã«ãšããŠã»ãŒããããŒãã§ãã
èšå®ãã³ã³ãã£ã°ãã¡ã€ã«ã«ä¿åããŠããã°åŸã§ãã®ã³ã³ãã£ã°ãã¡ã€ã«ãããŒãããŠèšå®ã埩å ã§ããã®ã§ããæ°ã«å ¥ãã®èšå®ã¯ãªãã¹ãä¿åããŠãããŸãããã
次ã«ã4ã€ã®ã¿ãããããŸããæåã®3ã€ã«ã€ããŠãããã詳ããèŠãŠãããŸãã
(ãToolsãã¿ãã¯LoRAåŠç¿æã«ã¯äœ¿ããªãã®ã§èª¬æã¯çç¥ããŸãã)
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230518/20230518004914.png)
ã¢ãã«éžæãåŠç¿ç»åãã©ã«ãã詳现èšå®ãããŒã«ã®åã¿ã
Source modelã¿ãïŒ åŠç¿ã«äœ¿ãããŒã¹ã¢ãã«ã®èšå®
Pretrained model name or path
ããã«ããŒã¹ã¢ãã«ã®å Žæãæå®ããŸããæåã«èª¬æããéããLoRAã¯æ¢åã®ã¢ãã«ã«å°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ããŸããã€ãŸããLoRAåŠç¿ãšã¯ãããŒã¹ã¢ãã«ïŒÎ±ãã®ãïŒÎ±ãã®éšåãäœãäœæ¥ã§ãã
LoRAåŠç¿ã¯ããŒã¹ã¢ãã«ã®ç¹åŸŽã«å€§ããªåœ±é¿ãåããã®ã§ã
- åŠç¿ããç»åãšçžæ§ã®ããããŒã¹ã¢ãã«
- ç»åçææã«äœ¿ã(ãšæ³å®ããã)ã¢ãã«ãšçžæ§ã®ããããŒã¹ã¢ãã«
ãéžã¶å¿ èŠããããŸããäŸãã°åŠç¿ç»åãå®åã®ãããªç»åãªããå®åçæãåŸæãªã¢ãã«ãéžã¶ãšããã§ããããåŠç¿ç»åã2次å 調ã§ãå®å調ã®ç»åçæãæ³å®ããŠãããªãã2次å 調ãš3次å 調ã®æ··åã¢ãã«ãéžã¶ã¹ããããããŸããã
ãªããåŠç¿åŸã«ã§ããLoRAãã¡ã€ã«ã¯ãè¿œå ããã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãã®ããŒã¿ã®ã¿ã§ãããŒã¹ã¢ãã«ã®ããŒã¿ã¯å ¥ã£ãŠããŸããããã®ãããå®æããLoRAãã¡ã€ã«ã䜿ã£ãŠç»åãçæãããšãã¯ãããã§æå®ããããŒã¹ã¢ãã«ã ãã§ãªããã©ããªã¢ãã«ãšãäžç·ã«äœ¿ãããšãã§ããŸãã
Model Quick Pick
ããã§ã¢ãã«ãéžã¶ãšãåŠç¿å®è¡æã«ãã®ã¢ãã«ãèªåçã«ãããçµç±ã§ããŠã³ããŒããããããŒã¹ã¢ãã«ãšããŠäœ¿çšãããŸããPretrained model name or pathã®æå®ã¯ç¡èŠãããŸãã
ããã¢ãã«ãPCã«ä¿åãããŠããªãå Žåããã©ã®ã¢ãã«ã䜿ã£ãŠããã®ãåãããªãå Žåã¯ãããã§éžæã§ããã¢ãã«ãéžãã§äœ¿ããŸãããã
ãrunwayml/stable-diffusion-v1-5ãã䜿ãããããšãå€ãããã§ãã
èªåã§çšæããã¢ãã«ã䜿ãããå Žåã¯customã«ããŸãããã
Save trained model as
åŠç¿æžã¿ã®LoRAãã¡ã€ã«ãã©ã®ãã¡ã€ã«åœ¢åŒã§ä¿åããããæå®ã§ããŸãã
ckptã¯ãã€ãŠStable Diffusionã§äœ¿ãããŠããäž»æµã®åœ¢åŒã§ãããããã®åœ¢åŒã«ã¯ã»ãã¥ãªãã£äžåé¡ããã£ããããsafetensorsãšããããå®å šãªãã¡ã€ã«åœ¢åŒãçãŸããŸãããçŸåšã§ã¯safetensorsãäž»æµãšãªã£ãŠããŸãã
ç¹å¥ãªçç±ããªãéãsafetensorsãéžã³ãŸãããã
v2
Stable Diffusionã®ã¢ãã«ã¯ãããŒãžã§ã³1ç³»ããšãããŒãžã§ã³2ç³»ãã®2ã€ã®ããŒãžã§ã³ãããããããã¯ããŒã¿æ§é ãããããéããŸããããŒãžã§ã³2ç³»ã¯(2023幎5ææç¹ã§)ãŸã æ®åããŠããããã»ãšãã©ã®æåã¢ãã«ã¯ãããŒãžã§ã³1ç³»ãã§ãã
ãããããããŒãžã§ã³2ç³»ãã®ã¢ãã«ãããŒã¹ã¢ãã«ãšããŠäœ¿ãå Žåã¯ãã®ãªãã·ã§ã³ããªã³ã«ããŸãããã
ããã©ã«ãã¯ãªãã§ãã
v_parameterization
v-parameterizationãšã¯ãããŒãžã§ã³2ç³»ãã¢ãã«ã§å°å ¥ãããææ³ã§ãåŸæ¥ãããå°ãªããµã³ããªã³ã°ã¹ãããã§å®å®ããŠç»åãçæããããã®ããªãã¯ã§ãã
ãããŒãžã§ã³1ç³»ãã®ã¢ãã«ã䜿çšãããšãã¯ãã®ãªãã·ã§ã³ã¯ãªãã§æ§ããŸããããã䜿ãã®ããŒã¹ã¢ãã«ãv- parameterizationãå°å ¥ããŠããããšãåãã£ãŠããå Žåã¯ããããªã³ã«ããŠãã ãããããããªã³ã«ãããšãã¯å¿ ãv2ããªã³ã«ããŸãããã
ããã©ã«ãã¯ãªãã§ãã
Foldersã¿ãïŒ åŠç¿ç»åã®å ŽæãšLoRAåºåå ã®èšå®
Image folder
åŠç¿ç»åãå«ããã©ã«ã(ã10_catãã®ãããªååã®ãã©ã«ã)ãããå Žæãæå®ããŸãã
ãç»åãããå Žæãã§ã¯ãããŸããïŒãç»åãå«ããã©ã«ããããå Žæããæå®ããŸãããã
Output folder
å®æåŸã®LoRAãã¡ã€ã«ã®åºåå ãæå®ããŸããåŠç¿ã®éäžçµéã®LoRAãåºåããå Žå(åŸè¿°)ããããã§æå®ããåºåå ã«åºåãããŸãã
Regularisation folder
LoRAåŠç¿ã§ã¯ãåŠç¿ç»åã®ç¹åŸŽãæå³ããªãåèªã«åŒ·ãçµã³ã€ããããŠããŸãããã®åèªãå ¥ãããã³ã«åŠç¿ç»åã«äŒŒãç»åããçæããªããªãããšããããšããã°ãã°èµ·ãããŸãã
ããã§ã[æ£åå](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25C0%25B5%25C2%25A7%25B2%25BD)ç»åããšãããåŠç¿ç»åã£ãœããªããç»åãäžç·ã«åŠç¿ãããããšã§ãç¹å®ã®åèªã«åŠç¿å¯Ÿè±¡ã匷ãçµã³ã€ããŠããŸãã®ãé²ãããšãã§ããŸãã
[æ£åå](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25C0%25B5%25C2%25A7%25B2%25BD)ç»åã®äœ¿çšã¯å¿ é ã§ã¯ãããŸãããããã[æ£åå](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25C0%25B5%25C2%25A7%25B2%25BD)ç»åãåŠç¿ã«äœ¿ãå Žåã¯ãããã§[æ£åå](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25C0%25B5%25C2%25A7%25B2%25BD)ç»åãå«ãã ãã©ã«ãã®å Žæãæå®ããŸãã
Logging folder
åŠç¿æã®åŠçããã°ãšããŠåºåããŠä¿åãããå Žåããã®å Žæãæå®ããŸãã
ããã§æå®ããååã®ãã©ã«ããäœæ¥ãã©ã«ãå ã«äœæãããããã«ãã®äžã«åŠç¿æ¥æãè¡šãååã®ãã©ã«ããã§ããŸãããã°ã¯ããã«ä¿åãããŸãã
ãªãããã°ãã¡ã€ã«ã¯ãtensorboardããšããããŒã«ãŸãã¯ãWandBããšãããªã³ã©ã€ã³ãµãŒãã¹(åŸè¿°)ã§ã°ã©ãåã§ããŸãã
Model output name
å®æããLoRAãã¡ã€ã«ã®ååãããã§æå®ããŸããæ¡åŒµåãã€ããå¿ èŠã¯ãããŸããã
ããã_ver1.0ã(ããã¯åŠç¿å¯Ÿè±¡ã®åå)ã®ããã«ããŒãžã§ã³çªå·ä»ãã®ååã«ãããšåãããããã§ãããã
ãªããååã«ã¯æ¥æ¬èªã䜿ããªãããã«ããŸãããã
Training comment
å®æããLoRAãã¡ã€ã«ã«ã¯ã[ã¡ã¿ããŒã¿](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25E1%25A5%25BF%25A5%25C7%25A1%25BC%25A5%25BF)ããšããŠããã¹ããåã蟌ãããšãã§ããŸããããåã蟌ã¿ããããã¹ããããå Žåã¯ããã«èšè¿°ããŸãã
ãªãã[ã¡ã¿ããŒã¿](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25E1%25A5%25BF%25A5%25C7%25A1%25BC%25A5%25BF)ã¯Stable Diffusion WebUIã®LoRAéžæç»é¢ã§âããŒã¯ãã¯ãªãã¯ãããšèŠãããšãã§ããŸãã
Training parametersã¿ãïŒ åŠç¿ã®è©³çŽ°èšå®
ãã®ã¿ãã§ã¯LoRAåŠç¿ã®ããã®ã»ãŒãã¹ãŠã®ãã©ã¡ãŒã¿ãèšå®ããŸãã
LoRA type
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230518/20230518010422.png)
LoRAåŠç¿ã®ã¿ã€ããæå®ããŸããäžã§è§£èª¬ããLoRAã¯ãã¹ã¿ã³ããŒããã¿ã€ãã§ãããDyLoRAãã¯æå®ããRank以äžã®è€æ°ã®ã©ã³ã¯ãåæã«åŠç¿ããã®ã§ãæé©ãªã©ã³ã¯ãéžã³ãããšãã«äŸ¿å©ã§ããLoHaã¯é«å¹çãªLoRAãLoConã¯åŠç¿ãU- Netã®Resãããã¯ãŸã§åºãããã®ã§ãã
æåã¯Standardã¿ã€ãã§åé¡ãããŸãããåŠç¿ãããŸããããªããšãã¯ã»ãã®ã¿ã€ããéžãã§ã¿ãŸãããã
LoRA network weights
æ¢ã«åŠç¿æžã¿ã®LoRAãã¡ã€ã«ã䜿ã£ãŠããã«è¿œå åŠç¿ãããããšãã¯ãããã§LoRAãã¡ã€ã«ãæå®ããŸãã
ããã§æå®ããLoRAã¯åŠç¿éå§æã«èªã¿èŸŒãŸãããã®LoRAã®ç¶æ ããåŠç¿ãã¹ã¿ãŒãããŸããåŠç¿åŸã®LoRAã¯ãŸãå¥ã®ãã¡ã€ã«ãšããŠä¿åãããã®ã§ãããã§æå®ããLoRAãã¡ã€ã«ãäžæžããããããšã¯ãããŸããã
DIM from weights
ããã¯LoRA network weightsã§è¿œå åŠç¿ãè¡ããšãéå®ã®ãªãã·ã§ã³ã§ãã
äžã®å³ã«ããéããLoRAã¯å°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ããŸããããã®äžéå±€ã®[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)æ°(ã©ã³ã¯æ°)ã¯Network Rank(åŸè¿°)ã§èªç±ã«èšå®ããããšãã§ããŸãã
ãããããã®ãªãã·ã§ã³ããªã³ã«ãããšãäœæããLoRAã®ã©ã³ã¯æ°ãLoRA network weightsã§æå®ããLoRAãšåãã©ã³ã¯æ°ã«èšå®ãããŸããããããªã³ã«ãããšãã¯Network Rankã®æå®ã¯ç¡èŠãããŸãã
äŸãã°è¿œå åŠç¿ã«äœ¿ãLoRAã®ã©ã³ã¯æ°ã32ã®æãäœæããLoRAã®ã©ã³ã¯æ°ã32ã«èšå®ãããŸãã
ããã©ã«ãã¯ãªãã§ãã
Train batch size
ããããµã€ãºãæå®ããŸããããããšã¯ããã£ãºãã«èªã¿èŸŒãç»åã®ææ°ãã§ããããããµã€ãº2ãªããäžåºŠã«2æã®ç»åãåæã«åŠç¿ããŸããéãçµµãè€æ°åæã«åŠç¿ãããšåã ã®çµµã«å¯Ÿãããã¥ãŒãã³ã°ç²ŸåºŠã¯èœã¡ãŸãããè€æ°ã®çµµã®ç¹åŸŽãå æ¬çã«ãšãããåŠç¿ã«ãªãã®ã§ãæçµçãªä»äžããã¯ããã£ãŠè¯ããªãå¯èœæ§ããããŸãã
(ç¹å®ã®çµµã«ãã¥ãŒãã³ã°ãããããšå¿çšã®å©ããªãLoRAã«ãªã£ãŠããŸããŸãã)
è€æ°ã®çµµãäžåºŠã«åŠç¿ããã®ã§ããããµã€ãºãäžããã°äžããã»ã©åŠç¿æéãçããªããŸããããã¥ãŒãã³ã°ç²ŸåºŠãäžãããããŠã§ã€ãå€æŽæ°ãæžãã®ã§ãå Žåã«ãã£ãŠã¯åŠç¿äžè¶³ã«ãªãå¯èœæ§ããããŸãã
(ããããµã€ãºãäžãããšãã¯åŠç¿ç(Learning rateãåŸè¿°ããŸã)ãäžããæ¹ããããšããå ±åããããŸããäŸãã°ããããµã€ãº2ãªãåŠç¿çã2åã«ããããšãã£ãæãã§ãã)
ãŸããããããµã€ãºãäžããã»ã©ã¡ã¢ãªãå€ãæ¶è²»ããŸããã䜿ãã®PCã®VRAMã®ãµã€ãºã«åãããŠæ±ºããŸãããã
VRAMã6GBããã°ããããµã€ãº2ããããããŠå¯èœã§ãããã
ããã©ã«ãã¯1ã§ãã
â»ãããããšã«åæã«èªã¿èŸŒãç»åã¯ãã¹ãŠåããµã€ãºã§ãªããã°ãªããªãã®ã§ãåŠç¿ç»åã®ãµã€ãºããã©ãã©ã ãšãããã§æå®ãããããæ°ãããå°ãªãææ°ããåæåŠçããªãããšãããŸãã
Epoch
1ãšããã¯ã¯ã1ã»ããã®åŠç¿ãã§ãã
äŸãã°50æã®ç»åããããã10åãã€èªã¿èŸŒãã§åŠç¿ããããšããŸãããã®å Žåã1ãšããã¯ã¯50x10ïŒ500åã®åŠç¿ã§ãã2ãšããã¯ãªãããã2åç¹°ãè¿ãã®ã§ã500x2ïŒ1000åã®åŠç¿ã«ãªããŸãã
æå®ããããšããã¯æ°ã®åŠç¿ãçµãã£ãåŸã«ãLoRAãã¡ã€ã«ãäœæãããæå®ã®å Žæã«ä¿åãããŸãã
LoRAã®å Žåã2ïœ3ãšããã¯ã®åŠç¿ã§ãååå¹æãåŸãããŸãã
Save every N epochs
ããã§æå®ãããšããã¯æ°ããšã«ãéäžçµéãLoRAãã¡ã€ã«ãšããŠä¿åããããšãã§ããŸãã
äŸãã°ãEpochãã§10ãšæå®ãããSave every N epochsãã2ã«æå®ãããšã2ãšããã¯ããš(2ã4ã6ã8ãšããã¯çµäºæ)ã«æå®ãã©ã«ãã«LoRAãã¡ã€ã«ãä¿åãããŸãã
éäžçµéã®LoRAäœæãäžèŠã®å Žåã¯ãããã®æ°å€ããEpochããšåãæ°å€ã«ããŸãããã
Caption Extension
ããç»åããšã«ãã£ãã·ã§ã³ãã¡ã€ã«ãçšæããŠããå Žåããã®ãã£ãã·ã§ã³ãã¡ã€ã«ã®æ¡åŒµåãããã§æå®ããŸãã
ããã空æ¬ã®å Žåãæ¡åŒµåã¯ã.captionãã«ãªããŸãããããã£ãã·ã§ã³ãã¡ã€ã«ã®æ¡åŒµåãã.txtãã®æã¯ãããã«ã.txtããšæå®ããŠãããŸãããã
ãã£ãã·ã§ã³ãã¡ã€ã«ããªãå Žåã¯ãç¡èŠããŠããŸããŸããã
Mixed precision
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230518/20230518015736.png)
åŠç¿æã®ãŠã§ã€ãããŒã¿ã®æ··å粟床ã®ã¿ã€ããæå®ããŸãã
æ¬æ¥ãŠã§ã€ãããŒã¿ã¯32ãããåäœ(noéžæã®å Žå)ã§ãããå¿ èŠã«å¿ããŠ16ãããåäœã®ããŒã¿ãæ··ããŠåŠç¿ãããšããªãã®ã¡ã¢ãªç¯çŽãã¹ããŒãã¢ããã«ã€ãªãããŸããfp16ã¯ç²ŸåºŠãååã«ãã[ããŒã¿åœ¢åŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C7%25A1%25BC%25A5%25BF%25B7%25C1%25BC%25B0)ãbf16ã¯32ãããããŒã¿ãšåãæ°å€ã®å¹ ãåãæ±ãããã工倫ãã[ããŒã¿åœ¢åŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C7%25A1%25BC%25A5%25BF%25B7%25C1%25BC%25B0)ã§ãã
fp16ã§åå粟床ã®é«ãLoRAãåŸãããŸãã
Save precision
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230518/20230518021841.png)
LoRAãã¡ã€ã«ã«ä¿åãããŠã§ã€ãããŒã¿ã®ã¿ã€ããæå®ããŸãã
floatã¯32ããããfp16ãšbf16ã¯16ãããåäœã§ããäžã®äºã€ã®æ¹ããã¡ã€ã«ãµã€ãºãå°ãããªããŸãã
ããã©ã«ãã¯fp16ã§ãã
Number of CPU threads per core
åŠç¿æã®CPUã³ã¢ããšã®ã¹ã¬ããã®æ°ã§ããåºæ¬çã«æ°å€ã倧ããã»ã©å¹çãäžãããŸãããã¹ããã¯ã«å¿ããŠèšå®ã調ç¯ããå¿ èŠããããŸãã
ããã©ã«ãã¯2ã§ãã
Seed
åŠç¿æã«ã¯ãã©ãããé çªã§ç»åãèªã¿èŸŒãããããåŠç¿ç»åã«ãã€ãºãã©ããããä¹ããã(詳现ã¯çç¥)ããªã©ãã©ã³ãã ãªåŠçãããã€ããããŸãã
Seedã¯ãã®ã©ã³ãã åŠçã®æé ã決ããããã®IDã®ãããªãã®ã§ãåãSeedãæå®ããã°æ¯ååãã©ã³ãã æé ã䜿ãããã®ã§åŠç¿çµæãåçŸãããããªããŸãã
ãã ããã®Seedã䜿ããªãã©ã³ãã åŠç(äŸãã°ç»åãã©ã³ãã ã«åãæãåŠçãªã©)ãããã®ã§ãåãSeedãæå®ããŠãå¿ ãåãåŠç¿çµæãåŸããããšã¯éããŸããã
ããã©ã«ãã¯ç©ºæ¬ã§ããæå®ããªããã°åŠç¿å®è¡æã«Seedãé©åœã«èšå®ãããŸãã
çµæããªãã¹ãåçŸããããªãé©åœã«(1234ãšã)æ°åãèšå®ããŠãããŠæã¯ãããŸããã
Cache latents
åŠç¿ç»åã¯VRAMã«èªã¿èŸŒãŸããU-Netã«å ¥ãåã«Latentãšããç¶æ ã«ãå§çž®ããããŠå°ãããªãããã®ç¶æ ã§VRAMå ã§åŠç¿ãããŸããéåžžãç»åã¯èªã¿èŸŒãŸãããã³ã«æ¯åãå§çž®ããããŸãããCache latentsã«ãã§ãã¯ãå ¥ãããšããå§çž®ãæžã¿ã®ç»åãã¡ã€ã³ã¡ã¢ãªã«ä¿æããããæå®ã§ããŸãã
ã¡ã€ã³ã¡ã¢ãªã«ä¿æãããšVRAMã®ã¹ããŒã¹ç¯çŽã«ãªããã¹ããŒããäžãããŸããããå§çž®ãåã®ç»åå å·¥ãã§ããªããªãã®ã§ãflip_aug以å€ã®augmentation(åŸè¿°)ã䜿ããªããªããŸãããŸããç»åãæ¯åã©ã³ãã ãªç¯å²ã§åãæãrandom crop(åŸè¿°)ã䜿ããªããªããŸãã
ããã©ã«ãã¯ãªã³ã§ãã
Cache latents to disk
Cache latentsãªãã·ã§ã³ãšäŒŒãŠããŸãããããã«ãã§ãã¯ãå ¥ãããšãå§çž®ç»åããŒã¿ãäžæãã¡ã€ã«ãšããŠãã£ã¹ã¯ã«ä¿åããããæå®ã§ããŸãã
kohya_ssãåèµ·åããåŸããã®äžæãã¡ã€ã«ãåå©çšã§ããã®ã§ãåãããŒã¿ã§äœåºŠãLoRAåŠç¿ããããå Žåã¯ãã®ãªãã·ã§ã³ããªã³ã«ãããšåŠç¿å¹çãäžãããŸãã
ãã ããããããªã³ã«ãããšflip_aug以å€ã®augmentationãšrandom cropã䜿ããªããªããŸãã
ããã©ã«ãã¯ãªãã§ãã
Learning rate:
åŠç¿çãæå®ããŸãããåŠç¿ããšã¯ãäžããããçµµãšãã£ãããªçµµãäœããããã«[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)å ã®é ç·ã®å€ªã(ãŠã§ã€ã)ãå€ããŠããããšã§ãããæ¯åçµµãäžããããããšã«ãŽããœãªé ç·ãå€ããŠããŸããšãäžããããçµµã®ã¿ã«ãã¥ãŒãã³ã°ããããŠãä»ã®çµµããŸã£ããæããªããªã£ãŠããŸããŸãã
ãããé¿ãããããæ¯åãäžããããçµµãã¡ãã£ãšã ãåã蟌ãããã«ãã¡ãã£ãšã ããŠã§ã€ããå€ããŸãããã®ãã¡ãã£ãšã ããã®éã決ããã®ããåŠç¿çã(Learning rate)ã§ãã
ããã©ã«ãå€ã¯0.0001ã§ãã
LR Scheduler:
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230519/20230519204207.png)
åŠç¿ã®éäžã§åŠç¿ç(Learning rate)ãå€ããããšãã§ããŸããã¹ã±ãžã¥ãŒã©ãŒãšã¯ãã©ããããµãã«åŠç¿çãå€ããŠãããã®èšå®ãã§ãã
- adafactorïŒãªããã£ãã€ã¶ãŒ(åŸè¿°)ãAdafactorã«èšå®ããå Žåã¯ãããéžæãããVRAMç¯çŽã®ããç¶æ³ã«å¿ããŠåŠç¿çãèªå調ç¯ããªããåŠç¿
- constantïŒåŠç¿çã¯æåããæåŸãŸã§å€ãããªã
- constant_with_warmupïŒæåã¯åŠç¿ç0ããå§ããŠãŠã©ãŒã ã¢ããäžã«Learning rateèšå®å€ã«åããŠã ãã ãå¢ãããæ¬åŠç¿ã®æã¯Learning rateèšå®å€ã䜿ã
- cosineïŒæ³¢(ã³ãµã€ã³ã«ãŒã)ãæããªããåŠç¿çãã ãã ã0ã«åããŠæžãã
- cosine_with_restartsïŒcosineãäœåºŠãç¹°ãè¿ã(LR number of cyclesã®èª¬æãèŠãŠãã ãã)
- linearïŒæåã¯Learning rateèšå®å€ã§å§ãã0ã«åããŠäžçŽç·ã«æžãã
- polynomialïŒæåã¯linearãšåããæžããæ¹ãå°ãè€é(LR powerã®èª¬æãèŠãŠãã ãã)
åŠç¿çãLearning rateèšå®å€ã«åºå®ããããªãconstantã«ããŠãã ããã
ããã©ã«ãã¯[cosine](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/cosine)ã§ãã
LR warmup
ã¹ã±ãžã¥ãŒã©ãŒã§constant_with_warmupãéžæããå ŽåããŠã©ãŒã ã¢ãããã©ããããã®åæ°è¡ãããããã§èšå®ããŸãã
ããã§æå®ããæ°å€ã¯å šäœã®ã¹ãããæ°ã®ããŒã»ã³ãã§ãã
äŸãã°ã50æã®ç»åãããããµã€ãº1ã§10ååŠç¿ãããã2ãšããã¯è¡ããšããç·ã¹ãããæ°ã¯50x10x2=1000ã§ããããLR warmupã10ã«èšå®ãããšãç·ã¹ããã1000ã®ãã¡æåã®10%ãã€ãŸã100ã¹ãããããŠã©ãŒã ã¢ããã«ãªããŸãã
ã¹ã±ãžã¥ãŒã©ãŒãconstant_with_warmupã§ãªããªãããã¯ç¡èŠããŠæ§ããŸããã
ããã©ã«ãã¯10ã§ãã
Optimizer
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230526/20230526012657.png)
[ãªããã£ã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25AA%25A5%25D7%25A5%25C6%25A5%25A3%25A5%25DE)ã€ã¶ãŒãšã¯ãåŠç¿äžã«[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®ãŠã§ã€ããã©ãã¢ããããŒãããããã®èšå®ã§ããè³¢ãåŠç¿ããããã«ãããããªææ³ãææ¡ãããŠããŸãããLoRAåŠç¿ã§æããã䜿ãããã®ã¯ãAdamWã(32ããã)ãŸãã¯ãAdamW8bitãã§ããAdamW8bitã¯VRAMã®äœ¿çšéãäœãã粟床ãååãªã®ã§è¿·ã£ããããã䜿ããŸãããã
ãã®ä»ãAdamææ³ãåãå ¥ãã€ã€åŠç¿ã®é²ã¿å ·åã«å¿ããŠåŠç¿çãé©åã«èª¿ç¯ãããAdafactorãããã䜿ãããããã§ã(Adafactorã䜿ãå Žåã¯Learning rateèšå®ã¯ç¡èŠãããŸã)ã
ãDAdaptãã¯åŠç¿çã調ç¯ãã[ãªããã£ã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25AA%25A5%25D7%25A5%25C6%25A5%25A3%25A5%25DE)ã€ã¶ãŒããLionãã¯æ¯èŒçæ°ãã[ãªããã£ã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25AA%25A5%25D7%25A5%25C6%25A5%25A3%25A5%25DE)ã€ã¶ãŒã§ãããŸã ååæ€èšŒãããŠããŸããããSGDNesterovãã¯åŠç¿ç²ŸåºŠã¯è¯ããã®ã®é床ãäžãããšããå ±åããããŸãã
ããã©ã«ãã¯AdamW8bitã§ããåºæ¬çã«ãã®ãŸãŸã§åé¡ãããŸããã
Optimizer extra arguments
æå®ãã[ãªããã£ã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25AA%25A5%25D7%25A5%25C6%25A5%25A3%25A5%25DE)ã€ã¶ãŒã«å¯ŸããŠããã«çŽ°ããèšå®ãããå Žåã¯ãããã§ã³ãã³ããæžããŸãã
éåžžã¯ç©ºæ¬ã®ãŸãŸã§æ§ããŸããã
Text Encoder learning rate
ããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã«å¯ŸããåŠç¿çãèšå®ããŸããæåã®ã»ãã§æžããéããããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã®è¿œå åŠç¿ã®åœ±é¿ã¯U- Netå šäœã«åã³ãŸãã
ãã®ãããéåžžã¯U-Netã®åãããã¯ã«å¯ŸããåŠç¿ç(Unet learning rate)ãããäœãããŠãããŸãã
ããã©ã«ãå€ã¯0.00005(5e-5)ã§ãã
ããã§æ°å€ãæå®ããå ŽåãLearning rateã®å€ããããã¡ããåªå ãããŸãã
Unet learning rate
U-Netã«å¯ŸããåŠç¿çãèšå®ããŸããU-Netã®äžã«ããåAttentionãããã¯(èšå®ã«ãã£ãŠã¯ä»ã®ãããã¯ã)ã«è¿œå åŠç¿ãè¡ããšãã®åŠç¿çã§ãã
ããã©ã«ãå€ã¯0.0001ã§ãã
ããã§æ°å€ãæå®ããå ŽåãLearning rateã®å€ããããã¡ããåªå ãããŸãã
Network Rank(Dimension)
èšäºã®äžã®æ¹ã§èª¬æãããè¿œå ããå°ããª[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãã®äžéå±€ã®[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)ã®æ°ãæå®ããŸã(詳现ã¯äžã®å³ãèŠãŠãã ãã)ã
[ãã¥ãŒãã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25ED%25A5%25F3)ã®æ°ãå€ãã»ã©åŠç¿æ å ±ãå€ãä¿æã§ããŸãããåŠç¿å¯Ÿè±¡ä»¥å€ã®äœèšãªæ å ±ãŸã§åŠç¿ããŠããŸãå¯èœæ§ãé«ããªããLoRAã®ãã¡ã€ã«ãµã€ãºã倧ãããªããŸãã
äžè¬çã«æ倧128çšåºŠã§èšå®ããããšãå€ãã§ããã32ã§ååãšããå ±åããããŸãã
è©Šéšçã«LoRAãäœãå Žåã¯2ïœ8ãããããå§ããã®ããããããããŸããã
ããã©ã«ãã¯8ã§ãã
Network alpha:
ããã¯ãLoRAä¿åæã«ãŠã§ã€ãã0ã«äžžã蟌ãŸããŠããŸãã®ãé²ãããã®äŸ¿å®äžã®åŠçœ®ãšããŠå°å ¥ããããã®ã§ãã
LoRAã¯ãã®æ§é äžã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®ãŠã§ã€ãå€ãå°ãããªããã¡ã§ãå°ãããªãããããšãŒã(ã€ãŸããªã«ãåŠç¿ããŠããªãã®ãšåã)ãšèŠåããã€ããªããªã£ãŠããŸãæãããããŸããããã§ãå®éã®(ä¿åããã)ãŠã§ã€ãå€ã¯å€§ããä¿ã¡ã€ã€ãåŠç¿æã«ã¯åžžã«ãŠã§ã€ããäžå®ã®å²åã§åŒ±ããŠãŠã§ã€ãå€ãå°ããèŠããããããšãããã¯ããã¯ãææ¡ãããŸããããã®ããŠã§ã€ãã匱ããå²åãã決ããã®ãNetwork alphaã§ãã
Network alphaå€ãå°ãããã°å°ããã»ã©ãä¿åãããLoRAã®[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®ãŠã§ã€ãå€ã倧ãããªããŸãã
䜿çšæã«ãŠã§ã€ããã©ãã ã匱ãŸãã(䜿çšåŒ·åºŠ)ã¯ãNetwork_Alpha/Network_Rankãã§èšç®ãã(ã»ãŒ0ïœ1ã®å€)ãNetwork Rankæ°ãšæ·±ãé¢ä¿ããŠããŸãã
åŠç¿åŸã®LoRAã®ç²ŸåºŠãããŸãã¡ãªå ŽåããŠã§ã€ãããŒã¿ãå°ããããŠ0ã«æœ°ããŠããŸã£ãŠããå¯èœæ§ããããŸãããããªæã¯Network Alphaå€ãäžããŠã¿ã(=ä¿åãŠã§ã€ãå€ã倧ãããã)ãšããã§ãããã
ããã©ã«ãã¯1(ã€ãŸãä¿åãŠã§ã€ãå€ããªãã¹ãæ倧ã«ãã)ã§ãã
Network AlphaãšNetwork Rankãåãå€ã®å Žåãå¹æã¯ãªãã«ãªããŸãã
â»Network Alphaå€ãNetwork Rankå€ãè¶ ããŠã¯ãããŸãããè¶ ããæ°åãæå®ããããšã¯å¯èœã§ãããé«ç¢ºçã§æå³ããªãLoRAã«ãªããŸãã
ãŸããNetwork Alphaãèšå®ãããšãã¯ãåŠç¿çãžã®åœ±é¿ãèããå¿ èŠããããŸãã
äŸãã°Alphaã16ãRankã32ã®å ŽåããŠã§ã€ãã®äœ¿çšåŒ·åºŠã¯16/32 = 0.5ã«ãªããã€ãŸãåŠç¿çããLearning Rateãèšå®å€ã®ããã«ååã®å¹åããæããªãããšã«ãªããŸãã
AlphaãšRankãåãæ°åã§ããã°äœ¿çšåŒ·åºŠã¯1ã«ãªããåŠç¿çã«äœã®åœ±é¿ãäžããŸããã
Max resolution
åŠç¿ç»åã®æ倧解å床ããå¹ ãé«ããã®é ã§æå®ããŸããããåŠç¿ç»åãããã§æå®ãã解å床ãè¶ ããå Žåããã®è§£å床ãŸã§çž®å°ãããŸãã
ããã©ã«ãã¯ã512,512ãã§ããå€ãã®ã¢ãã«ããã®ãµã€ãºã®ç»åã䜿ã£ãŠããã®ã§ãLoRAåŠç¿ã®æããã®ãµã€ãºã®ç»åã䜿ãã®ãç¡é£ã§ãã
Stop text encoder training
ããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã®åŠç¿ã¯éäžã§ã¹ãããããããšãã§ããŸããäžã§æžããéããããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã®ã¢ããããŒãã¯å šäœã«å€§ããªåœ±é¿ãåãŒãã®ã§[éåŠç¿](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25B2%25E1%25B3%25D8%25BD%25AC)(åŠç¿ç»åã«ãã¥ãŒãã³ã°ããããŠä»ã®ç»åãæããªããªã)ã«é¥ãããããã»ã©ã»ã©ã®ãšããã§åŠç¿ãã¹ããããããã®ã[éåŠç¿](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25B2%25E1%25B3%25D8%25BD%25AC)ãé²ãäžã€ã®æã§ãã
ããã§æå®ããæ°å€ã¯å šåŠç¿ã¹ãããã®ããŒã»ã³ãã§ããåŠç¿ããã®ããŒã»ã³ãã«éããããããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã¯åŠç¿ãã¹ãããããŸãã
äŸãã°ãç·ã¹ãããæ°ã1000ã ã£ãå Žåãããã§80ãšæå®ããããåŠç¿é²è¡åºŠã80%ã®æãã€ãŸã1000x0.8=800ã¹ãããã®æç¹ã§ããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã®åŠç¿ãçµäºããŸãã
U-Netã®åŠç¿ã¯æ®ã200ã¹ãããã§åŒãç¶ãè¡ãããŸãã
ããã0ã®å Žåãããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã®åŠç¿ã¯æåŸãŸã§ã¹ãããããŸããã
Enable buckets
ã[bucket](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/bucket)ããšã¯ãã®åã®éãããã±ãã(å ¥ãç©)ã§ããLoRAã§äœ¿ãåŠç¿ç»åã¯ãµã€ãºãçµ±äžãããŠããªããŠãããŸããªãã®ã§ãããéããµã€ãºã®ç»åãåæã«åŠç¿ããããšã¯ã§ããŸããããã®ãããåŠç¿åã«ç»åããµã€ãºã«å¿ããŠããã±ããã«æ¯ãåããå¿ èŠããããŸãã䌌ããµã€ãºã®ç»åã¯åããã±ãã«å ¥ããéããµã€ãºã®ç»åã¯å¥ã®ãã±ãã«å ¥ããŠãããŸãã
ããã©ã«ãã¯ãªã³ã§ãã
ããåŠç¿ç»åã®ãµã€ãºããã¹ãŠåããªããã®ãªãã·ã§ã³ã¯ãªãã«ããŠæ§ããŸãããããªã³ã®ãŸãŸã§ã圱é¿ã¯ãããŸããã
â»ããåŠç¿ç»åã®ãµã€ãºãçµ±äžãããŠããªãæã«Enable bucketsããªãã«ãããšãåŠç¿ç»åã¯æ¡å€§ãçž®å°ãããŠãµã€ãºãåã倧ããã«æããããŸãã
æ¡å€§ãçž®å°ã¯ç»åã®[ã¢ã¹ãã¯ãæ¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A2%25A5%25B9%25A5%25DA%25A5%25AF%25A5%25C8%25C8%25E6)ãä¿ã£ããŸãŸè¡ãããŸãã[ã¢ã¹ãã¯ãæ¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A2%25A5%25B9%25A5%25DA%25A5%25AF%25A5%25C8%25C8%25E6)ãåºæºãµã€ãºãšåãã§ãªãå Žåãæ¡å€§çž®å°åŸã®ç»åã®ã¿ãããšã³ãåºæºãµã€ãºããã¯ã¿åºãããšããããŸããäŸãã°ãåºæºãµã€ãºã512x512([ã¢ã¹ãã¯ãæ¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A2%25A5%25B9%25A5%25DA%25A5%25AF%25A5%25C8%25C8%25E6)1)ã§ãç»åãµã€ãºã1536x1024([ã¢ã¹ãã¯ãæ¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A2%25A5%25B9%25A5%25DA%25A5%25AF%25A5%25C8%25C8%25E6)1.5)ã®å Žåãç»åã¯çž®å°ãããŠ768x512([ã¢ã¹ãã¯ãæ¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A2%25A5%25B9%25A5%25DA%25A5%25AF%25A5%25C8%25C8%25E6)1.5ã®ãŸãŸ)ã«ãªããŸãã
Advanced Configuration
ããããåŸã¯ããAdvanced Configurationãã»ã¯ã·ã§ã³ã«ãããªãã·ã§ã³ã§ãã
WeightsãBlocksãConv
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230519/20230519233453.png)
ãããã¯U-Netå ã®åãããã¯ã®ãåŠç¿ã®éã¿ä»ãããšãã©ã³ã¯ãã®èšå®ã§ããããããã®ã¿ããéžæãããšã察å¿ããèšå®ç»é¢ã衚瀺ãããŸãã
â»ãããã®èšå®ã¯äžçŽè åãã§ãããã ããããªããªããã¹ãŠç©ºæ¬ã®ãŸãŸã§æ§ããŸããã
Weights: Down LR weights/Mid LR weights/Up LR weights
U-Netã®æ§é å³ãããããéããU-Netã¯12åã®INãããã¯ã1åã®MIDãããã¯ã12åã®OUTãããã¯ã®èš25åã®ãããã¯ããã§ããŠããŸãã
ããããã®ãããã¯ã®åŠç¿çã®ãŠã§ã€ã(éã¿)ãå€ãããå Žåãããã§åå¥ã«èšå®ããããšãã§ããŸãã
ããã§ãããŠã§ã€ããšã¯0ïœ1ã®æ°å€ã§è¡šããããåŠç¿ã®åŒ·ããã§ã0ã®å Žåã¯ããŸã£ããåŠç¿ããªããã1ã®å Žåã¯ãLearning rateã§èšå®ããåŠç¿çã§åŠç¿ããšããæãã§åŠç¿ã®åŒ·ããå€ããããšãã§ããŸãã
ãŠã§ã€ãã0.5ã«ããå ŽåãLearning rateã®ååã®åŠç¿çã«ãªããŸãã
ãDown LR weightsãã¯12åã®INãããã¯ã®ããããã®ãŠã§ã€ããæå®ããŸãã
ãMid LR weightsãã¯MIDãããã¯ã®ãŠã§ã€ããæå®ããŸãã
ãUp LR weightsãã¯12åã®OUTãããã¯ã®ããããã®ãŠã§ã€ããæå®ããŸãã
Weights: Blocks LR zero threshold
ãLoRAã¯[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ããããšèª¬æããŸãããããŠã§ã€ããå°ãããã(ã€ãŸãã»ãšãã©åŠç¿ããŠããªã)[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã¯è¿œå ããŠãæå³ããããŸãããããã§ãããŠã§ã€ããå°ãããããããã¯ã«ã¯[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ããªãããšããèšå®ãã§ããŸãã
ããã§èšå®ãããŠã§ã€ãå€ãè¶ ããªããããã¯ã§ã¯ã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ãããŸãããäŸãã°ããã«0.1ãšæå®ããå ŽåããŠã§ã€ãã0.1以äžã«èšå®ãããããã¯ã«ã¯[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãè¿œå ãããŸãã(æé€å¯Ÿè±¡ãæå®å€ãå«ãã§ããããšã«æ³šæããŠãã ããïŒ)ã
ããã©ã«ãã¯ç©ºæ¬ã§ã空æ¬ã®å Žåã¯0(äœãããªã)ã§ãã
Blocks: Block dims, Block alphas
ããã§ãIN0ïœ11ãMIDãOUT0ïœ11ã®25åã®åãããã¯ã«å¯Ÿãããããéãã©ã³ã¯(dim)å€ãšã¢ã«ãã¡å€ãèšå®ããããšãã§ããŸãã
ã©ã³ã¯å€ãšã¢ã«ãã¡å€ã«ã€ããŠã¯Network RankãNetwork alphaã®èª¬æãèŠãŠãã ããã
ã©ã³ã¯ã®å€§ãããããã¯ã¯ããå€ãã®æ å ±ãä¿æã§ããããšãæåŸ ãããŸãã
ãã®ãã©ã¡ãŒã¿å€ã¯åžžã«25åã®æ°åãæå®ããªããã°ãããŸããããLoRAã¯Attentionãããã¯ãåŠç¿å¯Ÿè±¡ãšããŠããã®ã§ãAttentionãããã¯ã®ååšããªãIN0ãIN3ãIN6ãIN9ãIN10ãIN11ãOUT0ãIN1ãIN2ã«å¯Ÿããèšå®(1ã4ã7ã11ã12ã14ã15ã16çªç®ã®æ°å)ã¯åŠç¿æã¯ç¡èŠãããŸãã
â»äžçŽè åãèšå®ã§ãããã ããããªããªã空æ¬ã®ãŸãŸã§æ§ããŸããããããæå®ããªãå Žåã¯ãNetwork Rank(Dimention)ãå€ãšãNetwork Alphaãå€ããã¹ãŠã®ãããã¯ã«é©å¿ãããŸãã
Conv: Conv dims, Conv, alphas
LoRAãåŠç¿å¯Ÿè±¡ãšããŠããAttentionãããã¯ã«ã¯ãConvããšãã[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ãããããããè¿œå åŠç¿ã«ããã¢ããããŒããããŸã(èšäºäžéšã®Attentionå±€ã®æ§é ã®å³ãèŠãŠãã ãã)ãããã¯ãç³ã¿èŸŒã¿ããšèšãããåŠçã§ãããã§äœ¿ãããŠããããã£ã«ã¿ãŒãã®å€§ããã¯1x1ãã¹ã§ãã
ç³ã¿èŸŒã¿ã«ã€ããŠã¯[ãã®èšäº](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://github.com/kohya-ss/sd-scripts/pull/121)ãèªãã§ãã ããã
äžæ¹ãAttention以å€ã®ãããã¯(ResãDownãããã¯)ãOUTã«ããAttentionãããã¯ã®äžéšã«ã¯ã[3x3](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/3x3)ãã¹ã®ãã£ã«ã¿ãŒã䜿ã£ãç³ã¿èŸŒã¿ãè¡ã£ãŠããéšåããããŸããæ¬æ¥ããã¯LoRAã®åŠç¿å¯Ÿè±¡ã§ã¯ãããŸãããããã®ãã©ã¡ãŒã¿ã§æå®ããããšã§Resãããã¯ã®[3x3](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/3x3)ã®ç³ã¿èŸŒã¿ãåŠç¿å¯Ÿè±¡ã«ããããšãã§ããŸãã
åŠç¿å¯Ÿè±¡ãå¢ããã®ã§ããã粟å¯ãªLoRAåŠç¿ãè¡ããå¯èœæ§ããããŸãã
èšå®æ¹æ³ã¯ãBlocks: Blocks dims, Blocks alphasããšåãã§ãã
[3x3](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/3x3)ã®Convã¯25å±€ãã¹ãŠã«ååšããŸãã
â»äžçŽè åãèšå®ã§ãããã ããããªããªã空æ¬ã®ãŸãŸã§æ§ããŸããã
No token padding
åŠç¿ç»åã«ã€ãããã£ãã·ã§ã³ã¯ã75[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³ããšã«åŠçãããŸã(ã[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³ãã¯åºæ¬çã«ãåèªããšæããŠåé¡ãããŸãã)ã
ãã£ãã·ã§ã³ã®é·ãã75[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³æªæºã®å Žåããã£ãã·ã§ã³ã®åŸã«çµç«¯èšå·ãå¿ èŠãªã ãè¿œå ããã75[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³ã«æããããŸããããããããã£ã³ã°ããšèšããŸãã
ããã§ã¯ã[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³ã®ããã£ã³ã°ãè¡ããªãããã«ããæå®ãã§ããŸãã
ããã©ã«ãã¯ãªãã§ããåºæ¬çã«ãªãã®ãŸãŸã§æ§ããŸããã
Gradient accumulation steps
ãŠã§ã€ãã®å€æŽ(ã€ãŸããåŠç¿ã)ã¯éåžžã¯1ãããèªã¿èŸŒãããšã«è¡ããŸãããåŠç¿ãè€æ°ããããŸãšããŠãã£ãºãã«è¡ãããšãã§ããŸããäœããããŸãšããŠãã£ãºãã«åŠç¿ããããæå®ããã®ããã®ãªãã·ã§ã³ã§ãã
ããã¯ãããæ°ãäžããåããšäŒŒãå¹æ(ãåãå¹æãã§ã¯ãããŸããïŒ)ããããŸãã
äŸãã°ãããããµã€ãºã4ã®å Žåã1ãããã§åæã«èªã¿èŸŒãŸããç»åæ°ã¯4æã§ããã€ãŸã4æèªã¿èŸŒãããšã«1ååŠç¿ãè¡ãããŸããããã§Gradient accumulation stepsã2ã«ãããšã2ãããããšã«1ååŠç¿ãè¡ãããã®ã§ãçµæçã«8æèªã¿èŸŒãããšã«1ååŠç¿ãè¡ãããããšã«ãªããŸããããã¯ãããæ°8ãšäŒŒãåã(åãã§ã¯ãããŸããïŒ)ã§ãã
ãã®æ°å€ãäžãããšåŠç¿åæ°ãæžãã®ã§åŠçãéããªããŸããã¡ã¢ãªãå€ãæ¶è²»ããŸãã
ããã©ã«ãã¯1ã§ãã
Weighted captions
çŸåšäžçªäººæ°ã®Stable Diffusionå©çšç°å¢ã¯ãStable Diffusion WebUIãã§ãããããã«ã¯ç¬ç¹ã®ããã³ããèšè¿°æ³ããããŸããäŸãã°ããã³ããã«ã[black cat](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/black%2520cat)ããšæå®ããæã«ãBlackãããã®ããã匷調ãããå Žåãã(black:1.2) catããšãã颚ã«åŒ·èª¿ãããã¯ãŒãããã£ãã§å²ã¿ãã¯ãŒãã®åŸã«ã:æ°åããšå ¥ãããšããã®æ°åã®åæ°ã ãã¯ãŒãã匷調ãããŸãã
ãã®èšè¿°æ³ãåŠç¿ç»åã®ãã£ãã·ã§ã³ã§ã䜿ããããã«ããã®ããã®ãªãã·ã§ã³ã§ãã
è€éãªãã£ãã·ã§ã³ãæžãããå Žåã¯è©ŠããŠã¿ãã®ãããã§ãããã
ããã©ã«ãã¯ãªãã§ãã
Prior loss weight
åŠç¿æã«ã[æ£åå](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25C0%25B5%25C2%25A7%25B2%25BD)ç»åã(詳ããã¯äžã®Regularisation folderã®èª¬æãèŠãŠãã ãã)ãã©ãã ãéèŠèŠãããã決ããã®ãPrior loss weightã§ãã
ãã®å€ãäœããšã[æ£åå](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25C0%25B5%25C2%25A7%25B2%25BD)ç»åã¯ããã»ã©éèŠã§ãªããšå€æãããããåŠç¿ç»åã®ç¹åŸŽã匷ãçŸããLoRAãçæãããŸãã
[æ£åå](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25C0%25B5%25C2%25A7%25B2%25BD)ç»åã䜿ããªãå Žåã¯ãã®èšå®ã¯æå³ããããŸããã
ããã¯0ïœ1ã®å€ã§ãããã©ã«ãã¯1([æ£åå](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25C0%25B5%25C2%25A7%25B2%25BD)ç»åãéèŠ)ã§ãã
LR number of cycles
ã¹ã±ãžã¥ãŒã©ãŒã«ã[Cosine](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/Cosine) with restartããŸãã¯ãPolynomialããéžãã å ŽåãåŠç¿äžã«ã¹ã±ãžã¥ãŒã©ãŒäœãµã€ã¯ã«å®è¡ããããæå®ãããªãã·ã§ã³ã§ãã
ãã®ãªãã·ã§ã³ã®æ°å€ã2以äžã®å Žåã1åã®åŠç¿äžã«ã¹ã±ãžã¥ãŒã©ãŒãè€æ°åå®è¡ãããŸãã
[Cosine](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/Cosine) with restartãPolynomialããåŠç¿ãé²ãã«ã€ããŠåŠç¿çã0ãŸã§ã ãã ãäžãã£ãŠãããŸããããµã€ã¯ã«æ°ãïŒä»¥äžã®å ŽåãåŠç¿çãïŒã«éãããåŠç¿çããªã»ããããŠåã¹ã¿ãŒãããŸãã
äžã®å³[(åŒçšå )](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://github.com/kohya-ss/sd- scripts/pull/121)ã¯[Cosine](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/Cosine) with restart(玫)ãšPolynomial(èç·)ã®åŠç¿çã®å€åã®äŸã§ãã
玫ã®äŸã§ã¯ãµã€ã¯ã«æ°ã4ã«èšå®ãããŠããŸããèç·ã®äŸã§ã¯ãµã€ã¯ã«æ°ã¯1ã§ãã
æå®ããããµã€ã¯ã«æ°ã決ããããåŠç¿ã¹ãããå ã§å®è¡ããã®ã§ããµã€ã¯ã«æ°ãå¢ããã°å¢ããã»ã©ãåŠç¿çã®å€åãæ¿ãããªããŸãã
ããã©ã«ãã¯ç©ºæ¬ã§ã空æ¬ã®å Žåã¯1ã«ãªããŸãã
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230525/20230525001355.png)
åŠç¿çã®åãã®äŸ
[Cosine](https://translate.google.com/website?sl=auto&tl=en&hl=en-
US&client=webapp&u=https://d.hatena.ne.jp/keyword/Cosine) with restartã§ãLR
number of cycle = 4ã (玫)
Polynomialã§ãLR power = 2ã (èç·)
LR power
ããã¯ã¹ã±ãžã¥ãŒã©ãŒã«Polynomialãèšå®ããå Žåã®ãªãã·ã§ã³ã§ããã®æ°ã倧ãããã°å€§ããã»ã©æåã®åŠç¿çã®äžããæ¹ãæ¥æ¿ã«ãªããŸãã(äžã®å³ã®èç·ã®ç·ã®ã¹ããŒããæ¥æ¿ã«ãªããŸã)ã
powerã1ã®æã¯linearã¹ã±ãžã¥ãŒã©ãŒãšåã圢ã«ãªããŸãã
ããŸãæ°ã倧ãããããããšåŠç¿çã0ã¡ããã«åŒµãä»ããŠããŸã£ãŠåŠç¿äžè¶³ã«é¥ãã®ã§æ°ãã€ããŸãããã
ããã©ã«ãã¯ç©ºæ¬ã§ã空æ¬ã®å Žåã¯1(ã€ãŸãlinearã¹ã±ãžã¥ãŒã©ãŒãšåã)ã«ãªããŸãã
Additional parameters
kohya_ssã®[GUI](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/GUI)ã«è¡šç€ºãããŠããªãåŠç¿èšå®ãã©ã¡ãŒã¿ããããããå Žåãããã§ã³ãã³ããšããŠå ¥åããŸãã
éåžžã¯ç©ºæ¬ã®ãŸãŸã§æ§ããŸããã
Save every N steps
ããã§æå®ããã¹ãããæ°ã®åŠç¿ãçµäºããããšã«ãLoRAãã¡ã€ã«ãäœæãããä¿åãããŸãã
äŸãã°ç·åŠç¿ã¹ãããæ°ã1000ã®æãããã§200ãšæå®ãããšã200ã400ã600ã800ã¹ãããçµäºæã«LoRAãã¡ã€ã«ãä¿åãããŸãã
éäžçµéã®LoRAä¿åã«ã€ããŠã¯ãSave every N epochsããåç §ããŠãã ããã
ããã©ã«ãã¯0(éäžçµéLoRAãä¿åããªã)ã§ãã
Save last N steps
åŠç¿éäžã®LoRAãä¿åããããSave every N stepsã§æå®ããå Žåã®ãªãã·ã§ã³ã§ãã
ããæè¿ã®LoRAãã¡ã€ã«ã®ã¿ä¿æããŠå€ãLoRAãã¡ã€ã«ã¯ç Žæ£ãããå Žåãããã§ãæè¿äœã¹ãããåã®LoRAãã¡ã€ã«ãä¿æããŠãããããèšå®ã§ããŸãã
äŸãã°ç·åŠç¿ã¹ãããã600ã®æãSave every N stepsãªãã·ã§ã³ã§100ã¹ãããããšã«ä¿åããããæå®ãããšããŸãããããš100ã200ã300ã400ã500ã¹ãããç®ã«LoRAãã¡ã€ã«ãä¿åãããŸãããSave every N stepsã300ãšæå®ããå Žåãæè¿300ã¹ãããåã®LoRAãã¡ã€ã«ã®ã¿ä¿æãããŸããã€ãŸã500ã¹ãããç®ã«ã¯200(=500-300)ã¹ãããç®ããå€ãLoRA(ã€ãŸã100ã¹ãããç®ã®LoRA)ã¯æ¶å»ãããŸãã
ããã©ã«ãã¯0ã§ãã
Keep n tokens
åŠç¿ç»åã«ãã£ãã·ã§ã³ãã€ããŠããå Žåããã®ãã£ãã·ã§ã³å ã®ã³ã³ãã§åºåãããåèªãã©ã³ãã ã«å ¥ãæ¿ããããšãã§ããŸã(詳ããã¯Shuffle captionãªãã·ã§ã³ãèŠãŠãã ãã)ããããããã£ãšå é ã«çœ®ããŠããããåèªãããå Žåã¯ããã®ãªãã·ã§ã³ã§ãæåã®ãåèªã¯å é ã«åºå®ããŠãããŠããšæå®ã§ããŸãã
ããã§æå®ããæ°ã®æåã®åèªã¯ããã€ãå é ã«åºå®ãããŸãã
ããã©ã«ãã¯0ã§ããShuffle captionãªãã·ã§ã³ããªãã®å Žåã¯ãã®ãªãã·ã§ã³ã¯äœãããŸããã
â»ããã§ãããåèªããšã¯ãã³ã³ãã§åºåãããããã¹ãã®ããšã§ããåºåãããããã¹ããããã€åèªãå«ãã§ããããšãããã¯ã1åèªããšããŠã«ãŠã³ããããŸãã
ã[black cat](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/black%2520cat), eating, sittingãã®å Žåãã[black cat](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/black%2520cat)ãã§1åèªã§ãã
Clip skip
ããã¹ã[ãšã³ã³ãŒããŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A8%25A5%25F3%25A5%25B3%25A1%25BC%25A5%25C0%25A1%25BC)ã«ã¯ãCLIPããšããä»çµã¿ã䜿ãããŠããŸãããããã¯12å±€ã®äŒŒããããªã¬ã€ã€ãŒããã§ããŠããŸãã
ããã¹ã([ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³)ã¯æ¬æ¥ããã®12å±€ã®ã¬ã€ã€ãŒãéã£ãŠæ°åã®å(ãã¯ãã«)ã«å€æãããæåŸã®ã¬ã€ã€ãŒããåºãŠãããã¯ãã«ãU- Netã®Attentionãããã¯ã«éãããŸãã
ãããããNovel AIããšãããµãŒãã¹ãç¬èªã«éçºããã¢ãã«ãé称ãNovel AIã¢ãã«ãã¯ãæåŸã®ã¬ã€ã€ãŒã§ãªãæåŸãã2çªç®ã®ã¬ã€ã€ãŒãåºåãããã¯ãã«ã䜿ãããšããç¬èªä»æ§ãæ¡çšããŸãããNovel AIã¢ãã«ãã掟çããã¢ãã«ãåæ§ã§ãããã®ããããåŠç¿ã«äœ¿ãããŒã¹ã¢ãã«ãCLIPã®ã©ã®ã¬ã€ã€ãŒããåºãŠãããã¯ãã«ã䜿ã£ãŠãããããšããæå®ãå¿ èŠã«ãªããŸãã
ãã®ãæåŸãããçªç®ãã®ã¬ã€ã€ãŒçªå·ãæå®ããã®ããClip skipãã§ãã
ããã2ã«ãããšãæåŸãã2çªç®ã®ã¬ã€ã€ãŒã®åºåãã¯ãã«ãAttentionãããã¯ã«éãããŸãã1ã®å Žåã¯ãæåŸã®ã¬ã€ã€ãŒã®åºåãã¯ãã«ã䜿ãããŸãã
ããŒã¹ã¢ãã«ã«Novel AIã¢ãã«(ãŸãã¯ãã®ããã¯ã¹ã¢ãã«)ã䜿ãããŠããå Žåã¯ã2ã«ããæ¹ãããã§ãããããã®ã»ãã®å Žåã¯1ã§æ§ããŸããã
Max Token Length
![](https://cdn-ak.f.st- hatena.com/images/fotolife/h/hoshikat/20230520/20230520021639.png)
ãã£ãã·ã§ã³ã«å«ãŸããæ倧ã®[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³ã®é·ããæå®ããŸãã
ããã§ããã[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³ãã¯åèªæ°ã§ã¯ãªãã[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³æ°ã¯åèªæ°ãšã ãããåãïœ1.5åãããã®æ°ã«ãªããŸããã³ã³ãã1[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³ãšã«ãŠã³ããããããšã«æ³šæããŠãã ããã
75[ããŒã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C8%25A1%25BC%25A5%25AF)ã³ãè¶ ãããã£ãã·ã§ã³ã䜿ãããšã¯ãã£ãã«ãªãã§ãããããããã£ãã·ã§ã³ã®æãé·ããªããšæã£ããšãã¯ãããã§ãã倧ããªæ°åãæå®ããŠãã ããã
Full fp16 training (experimental)
äžã§èª¬æãããªãã·ã§ã³ãMixed precisionãããªã³(fp16ãŸãã¯bf16)ã«ãããšãåŠç¿æã«32ããããš16ãããã®ããŒã¿ãæ··åããŠäœ¿çšãããŸããããã®ãªãã·ã§ã³ããªã³ã«ãããšãã¹ãŠã®ãŠã§ã€ãããŒã¿ã16ããã(fp16圢åŒ)ã«æããããŸããã¡ã¢ãªã®ç¯çŽã«ã¯ãªããŸãããäžéšããŒã¿ç²ŸåºŠãååã«ãªãã®ã§åŠç¿ç²ŸåºŠãèœã¡ãå¯èœæ§ããããŸãã
ããã©ã«ãã¯ãªãã§ãããã£ãœã©ã¡ã¢ãªãç¯çŽããããšã以å€ã¯ãªãã®ãŸãŸã§ããã§ãããã
Gradient checkpointing
éåžžã®å ŽåãåŠç¿äžã¯ãç»åãèªã¿èŸŒãŸããããšã«èšå€§ãªæ°ã®[ãã¥ãŒã©ã«ããã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25CB%25A5%25E5%25A1%25BC%25A5%25E9%25A5%25EB%25A5%25CD%25A5%25C3%25A5%25C8)ã®ãŠã§ã€ããäžæã«ä¿®æ£ãã¢ããããŒãããŸããããããäžæãã§ãªããå°ããã€ãä¿®æ£ããããšã§ãèšç®åŠçãæžãããŠã¡ã¢ãªãç¯çŽã§ããŸãã
ãã®ãªãã·ã§ã³ã¯ãŠã§ã€ãèšç®ãå°ããã€è¡ãããã«æå®ããŸããããããªã³ã«ããŠããªãã«ããŠãLoRAã®åŠç¿çµæã«åœ±é¿ã¯ãããŸããã
ããã©ã«ãã¯ãªãã§ãã
Shuffle caption
åŠç¿ç»åã«ãã£ãã·ã§ã³ãã€ããŠããå Žåããã£ãã·ã§ã³ã®å€ãã¯ã[black cat](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/black%2520cat), eating, sittingããšãã£ãå ·åã«ã³ã³ãã§åºåãããåèªã䞊ãã 圢åŒã§æžãããŠããããšãå€ãã§ãããããã®ã³ã³ãã§åºåãããŠããåèªã®é çªãæ¯åã©ã³ãã ã«å ¥ãæ¿ããã®ãShuffle captionãªãã·ã§ã³ã§ãã
äžè¬çã«ãã£ãã·ã§ã³å ã®åèªã¯å é ã«è¿ãã»ã©éèŠãããŸãããã®ãããåèªã®é çªãåºå®ãããŠãããšåŸæ¹ã®åèªãããŸãåŠç¿ãããªãã£ãããåæ¹ã®åèªãåŠç¿ç»åãšæå³ããªãçµã³ã€ããããå¯èœæ§ããããŸããç»åãèªã¿èŸŒãããšã«æ¯ååèªã®é çªãå ¥ãæ¿ããããšã§ããã®ãããããä¿®æ£ã§ããããšãæåŸ ãããŸãã
ãã£ãã·ã§ã³ãã³ã³ãåºåãã§ãªãæç« ã«ãªã£ãŠããå Žåã¯ãã®ãªãã·ã§ã³ã¯æå³ããããŸããã
ããã©ã«ãã¯ãªãã§ãã
â»ããã§ãããåèªããšã¯ãã³ã³ãã§åºåãããããã¹ãã®ããšã§ããåºåãããããã¹ããããã€åèªãå«ãã§ããããšãããã¯ã1åèªããšããŠã«ãŠã³ããããŸãã
ã[black cat](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/black%2520cat), eating, sittingãã®å Žåãã[black cat](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/black%2520cat)ãã§1åèªã§ãã
Persistent data loader
åŠç¿ã«å¿ èŠãªããŒã¿ã¯1ã€ã®ãšããã¯ãçµããããšã«ç Žæ£ãããåèªã¿èŸŒã¿ãããŸãããããç Žæ£ããã«ä¿æããŠããããã®ãªãã·ã§ã³ã§ãããã®ãªãã·ã§ã³ããªã³ã«ãããšæ°ãããšããã¯ã®åŠç¿ãå§ãŸãé床ãäžãããŸãããããŒã¿ãä¿æããåã¡ã¢ãªãæ¶è²»ããŸãã
ããã©ã«ãã¯ãªãã§ãã
Memory efficient attention
ããã«ãã§ãã¯ãå ¥ãããšVRAMã®äœ¿çšãæããŠAttentionãããã¯ã®åŠçãè¡ããŸãã次ã®ãªãã·ã§ã³ã®ãxformersãã«æ¯ã¹ãŠã¹ããŒãã¯é ããªããŸããVRAMã®å®¹éãå°ãªãå Žåã¯ãªã³ã«ããŸãããã
ããã©ã«ãã¯ãªãã§ãã
Use xformers
ãxformersããšãã[Python](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/Python)ã©ã€ãã©ãªã䜿çšãããšãè¥å¹²ã®ã¹ããŒãäœäžãšåŒãæãã«VRAMã®äœ¿çšãæããŠAttentionãããã¯åŠçãè¡ããŸããVRAMã®å®¹éãå°ãªãå Žåã¯ãªã³ã«ããŸãããã
ããã©ã«ãã¯ãªã³ã§ãã
Color augmentation
ãaugmentationããšã¯ãç»åã®æ°Žå¢ãããæå³ããŸããåŠç¿ç»åãæ¯åå°ãå å·¥ããããšã«ãããåŠç¿ç»åã®çš®é¡ãç䌌çã«å¢ãããŸãã
Color augmentationããªã³ã«ãããšãç»åã®è²çž(Hue)ãæ¯åã©ã³ãã ã«å°ãå€åãããŸããããã«ãã£ãŠåŠç¿ããLoRAã¯è²èª¿ã«è¥å¹²ã®å¹ ãåºãããšãæåŸ ãããŸãã
Cache latentsãªãã·ã§ã³ããªã³ã®å Žåã¯äœ¿çšã§ããŸããã
ããã©ã«ãã¯ãªãã§ãã
Flip augmentation
ãã®ãªãã·ã§ã³ããªã³ã«ãããšãã©ã³ãã ã«ç»åãå·Šå³å転ããŸããå·Šå³ã®ã¢ã³ã°ã«ãåŠç¿ã§ããã®ã§ã å·Šå³å¯Ÿç§° ã®äººç©ãç©äœãåŠç¿ããããšãã¯æçã§ãããã
ããã©ã«ãã¯ãªãã§ãã
Min [SNR](https://translate.google.com/website?sl=auto&tl=en&hl=en-
US&client=webapp&u=https://d.hatena.ne.jp/keyword/SNR) gamma
LoRAåŠç¿ã§ã¯åŠç¿ç»åã«ãããããªåŒ·ãã®ãã€ãºãä¹ããŠåŠç¿ããŸã(ãã®ãããã®è©³çŽ°ã¯çç¥)ããä¹ã£ãŠãããã€ãºã®åŒ·ãã®éãã«ãã£ãŠåŠç¿ç®æšã«è¿å¯ã£ããé¢ãããããŠåŠç¿ãå®å®ããªãããšããããMin [SNR](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/SNR) gammaã¯ãããè£æ£ããããã«å°å ¥ãããŸãããç¹ã«ãã€ãºãããŸãä¹ã£ãŠããªãç»åãåŠç¿ãããšãã¯ç®æšãã倧ããé¢ãããããã®ã§ããã®ãžã£ã³ããæããããã«ããŸãã
詳现ã¯ãããããã®ã§çç¥ããŸããããã®å€ã¯0ïœ20ã§èšå®ã§ããããã©ã«ãã¯0ã§ãã
ãã®æ¹æ³ãæå±ããè«æã«ãããšæé©å€ã¯5ã ããã§ãã
ã©ãã»ã©å¹æçãªã®ãã¯äžæã§ãããåŠç¿çµæã«äžæºãããæã¯ãããããªå€ãè©ŠããŠã¿ããšããã§ãããã
Don't upscale
[bucket](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/bucket) resolution
[Bucket](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/Bucket)(ãã±ã)ã®ãµã€ãºã¯ããã©ã«ãã§ã¯256ïœ1024[ãã¯ã»ã«](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D4%25A5%25AF%25A5%25BB%25A5%25EB)(ãŸãã¯Max resolutionãªãã·ã§ã³ã§æ倧解å床ãæå®ããŠããå Žåã¯ãã¡ããåªå ãããŸã)ã«èšå®ãããŠããŸããã¿ãããšã³ã®ã©ã¡ããäžæ¹ã§ããã®ãµã€ãºç¯å²ããå€ããç»åã¯ãæå®ç¯å²å ã®ãµã€ãºã«ãªãããã«([ã¢ã¹ãã¯ãæ¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25A2%25A5%25B9%25A5%25DA%25A5%25AF%25A5%25C8%25C8%25E6)ãä¿ã£ããŸãŸ)æ¡å€§ãŸãã¯çž®å°ãããŸãã
ãããããã®ãªãã·ã§ã³ããªã³ã«ãããšãã±ããµã€ãºã®ç¯å²èšå®ã¯ç¡èŠãããåŠç¿ç»åã®ãµã€ãºã«å¿ããŠèªåçã«ãã±ããçšæãããã®ã§ããã¹ãŠã®åŠç¿ç»åãæ¡å€§çž®å°ãããã«èªã¿èŸŒãŸããããã«ãªããŸãããã ããã®æã[Bucket](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/Bucket) resolution steps(åŸè¿°)ã«ãµã€ãºãåãããããç»åã®äžéšãåãåãããå¯èœæ§ã¯ãããŸãã
ããã©ã«ãã¯ãªã³ã§ãã
[Bucket](https://translate.google.com/website?sl=auto&tl=en&hl=en-
US&client=webapp&u=https://d.hatena.ne.jp/keyword/Bucket) resolution steps
[Bucket](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/Bucket)(ãã±ã)ã䜿çšããå Žåãåãã±ãã®è§£å床ééãããã§æå®ããŸãã
äŸãã°ããã§64ãæå®ããå Žåãããããã®åŠç¿ç»åããµã€ãºã«å¿ããŠ64[ãã¯ã»ã«](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D4%25A5%25AF%25A5%25BB%25A5%25EB)ããšã«å¥ã®ãã±ãã«æ¯ãåããŸãããã®æ¯ãåãã¯ã¿ããšã³ããããã«å¯ŸããŠè¡ãããŸãã
ããç»åãµã€ãºããã±ãã®æå®ãããµã€ãºããã¿ãªã§ãªãå Žåãã¯ã¿åºããéšåã¯åãåãããŸãã
äŸãã°ãæ倧解å床ã512[ãã¯ã»ã«](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D4%25A5%25AF%25A5%25BB%25A5%25EB)ã§ãã±ãã®ã¹ããããµã€ãºã64[ãã¯ã»ã«](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D4%25A5%25AF%25A5%25BB%25A5%25EB)ããšã®å Žåããã±ãã¯512ã448ã384âŠãšãªããŸããã500[ãã¯ã»ã«](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D4%25A5%25AF%25A5%25BB%25A5%25EB)ã®ç»åã¯448[ãã¯ã»ã«](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D4%25A5%25AF%25A5%25BB%25A5%25EB)ã®ãã±ãã«å ¥ãããããµã€ãºãåãããããäœåãª52[ãã¯ã»ã«](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D4%25A5%25AF%25A5%25BB%25A5%25EB)ãåãåãããŸãã
ããã©ã«ãã¯64[ãã¯ã»ã«](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D4%25A5%25AF%25A5%25BB%25A5%25EB)ã§ãã
â»ãã®æ°å€ãããŸãå°ãããããããšãã±ãã®æ¯ãåãã现ãããªããããŠããŸããææªãç»å1æããšã«1ã€ã®ãã±ããã®ãããªç¶æ ã«ãªã£ãŠããŸããŸãã
1ãããã«ã€ãå¿ ãåããã±ãããç»åãèªã¿èŸŒãã®ã§ããã±ãã®äžã®ç»åãå°ãªããããšãããæ°ãæå³ããå°ãªããªã£ãŠããŸãããšã«æ³šæããŠãã ããã
Random crop instead of center crop
äžèšã®ããã«ãäžéå端ãªãµã€ãºã®ç»åã¯ãã±ãã«æ¯ãåããåŸã«äžéšãåãåãããŠãµã€ãºãæããããŸãããéåžžã¯ç»åã®äžå¿ãä¿ã€ããã«åãåãããŸãã
ãã®ãªãã·ã§ã³ããªã³ã«ãããšãçµµã®ã©ã®éšåãåãåãããããã©ã³ãã ã«æ±ºãŸããŸããåŠç¿ã®ç¯å²ãç»åã®äžå¿ä»¥å€ã«åºããããšãã¯ãã®ãªãã·ã§ã³ããªã³ã«ããŸãã
â»cache latentsãªãã·ã§ã³ããªã³ã«ããŠãããšãã¯ãã®ãªãã·ã§ã³ã¯äœ¿ããŸããã
Noise offset type
åŠç¿ç»åã«è¿œå ãã€ãºãä¹ãããšãã«ãã©ã®ææ³ã§ä¹ããã®ããæå®ãããªãã·ã§ã³ã§ããåŠç¿æã«ã¯å¿ ãç»åã«ãã€ãºãä¹ãã(ãã®èŸºã®è©³çŽ°ã¯çç¥ããŸã)ã®ã§ããããã®ãã€ãºã¯ãäºæž¬ãã¥ããããã€ãºã§ããæ¹ããã奜ãŸãããããããã«å€ãã®ãã€ãºãä¹ããããšã§ãããäºæž¬ãã¥ããããã€ãºã«ããŸãã
ããã©ã«ãã¯Originalã§ããMultiresã¯ããå°ãè€éãªæ¹æ³ã§ãã€ãºãè¿œå ããŸãã
Noise offset
Noise offset typeã«ãOriginalããéžæãããšãã®ãªãã·ã§ã³ã§ããããã§0ãã倧ããªå€ãå ¥ãããšè¿œå ãã€ãºãä¹ããŸããå€ã¯0ïœ1ã§ã0ã®å Žåã¯ãŸã£ãããã€ãºãè¿œå ããŸããã1ã®å Žåã¯åŒ·ããã€ãºãè¿œå ããŸãã
0.1çšåºŠã®ãã€ãºãè¿œå ãããšLoRAã®è²åããé®®ããã«ãªã(ææãã¯ã£ãããã)ãšããå ±åããããŸããããã©ã«ãã¯0ã§ãã
Adaptive noise scale
Noise offsetãªãã·ã§ã³ãšãã¢ã§äœ¿ããŸããããã«æ°å€ãæå®ãããšãNoise offsetã§æå®ããè¿œå ãã€ãºéãããã«èª¿æŽããå¢å¹ ãããã¯æžè¡°ããŸããå¢å¹ (ãŸãã¯æžè¡°)ããéã¯ããç»åã«çŸåšã©ã®ããããã€ãºãä¹ã£ãŠããããã«ãã£ãŠèªåçã«èª¿æŽãããŸããå€ã¯-1ïœ1ã§ããã©ã¹ãæå®ãããšè¿œå ãã€ãºéãå¢ãããã€ãã¹ãæå®ããå Žåã¯è¿œå ãã€ãºéãæžããŸãã
ããã©ã«ãã¯0ã§ãã
Multires noise iterations
Noise offset typeã«ãMultiresããéžæãããšãã®ãªãã·ã§ã³ã§ããããã§0ãã倧ããªå€ãå ¥ãããšè¿œå ãã€ãºãä¹ããŸãã
Multiresã§ã¯ãæ§ã ãªè§£å床ã®ãã€ãºãäœã£ãŠãããã足ãããšã§æçµçãªè¿œå ãã€ãºãäœæããŸããããã§ã¯ãæ§ã ãªè§£å床ããããã€äœãããæå®ããŸãã
ããã©ã«ãã¯0ã§ã0ã®æã¯è¿œå ãã€ãºã¯ä¹ããŸããã䜿çšãããå Žåã¯6ã«èšå®ããããšããæšå¥šãããŠããŸãã
Multires noise discount
Multires noise iterationsãªãã·ã§ã³ãšãã¢ã§äœ¿ããŸããå解å床ã®ãã€ãºéãããçšåºŠåŒ±ããããã®æ°å€ã§ãã0ïœ1ã®å€ã§ãæ°åãå°ããã»ã©ãã€ãºããã匱ãŸããŸããã¡ãªã¿ã«åŒ±ããéã¯è§£å床ã«ãã£ãŠéãã解å床ã®äœããã€ãºã¯ãããã匱ããŸãã
ããã©ã«ãã¯0ã§ã0ã®å Žåã¯äœ¿çšæã«0.3ã«èšå®ãããŸããéåžžã¯0.8ãæšå¥šãããŠããŸããåŠç¿ç»åãæ¯èŒçå°ãªãå Žåã¯0.3çšåºŠã«äžãããšè¯ãããã§ãã
Dropout caption every n epochs
éåžžãç»åãšãã£ãã·ã§ã³ã¯ãã¢ã§åŠç¿ãããŸãããç¹å®ã®ãšããã¯ããšã«ãã£ãã·ã§ã³ã䜿ããããã£ãã·ã§ã³ãªãã®ç»åãã®ã¿åŠç¿ãããããšãã§ããŸãã
ãã®ãªãã·ã§ã³ã¯ãããšããã¯ããšã«ãã£ãã·ã§ã³ã䜿ããªã([ããããã¢ãŠã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C9%25A5%25ED%25A5%25C3%25A5%25D7%25A5%25A2%25A5%25A6%25A5%25C8))ããšããæå®ãè¡ããŸãã
äŸãã°ããã§2ãæå®ãããšã2ãšããã¯ããšã«(2ãšããã¯ç®ã4ãšããã¯ç®ã6ãšããã¯ç®âŠ)ãã£ãã·ã§ã³ã䜿ããªãç»ååŠç¿ãè¡ããŸãã
ãã£ãã·ã§ã³ã®ãªãç»åãåŠç¿ãããšããã®LoRAã¯ããå æ¬çãªç»åã®ç¹åŸŽãåŠç¿ããããšãæåŸ ãããŸãããŸããç¹å®ã®åèªã«ç»åã®ç¹åŸŽãçµã³ä»ããããªãããã«ããå¹æãæåŸ ã§ããŸãããã ãããŸããã£ãã·ã§ã³ã䜿ããªããããšããã®LoRAã¯ããã³ããã®å¹ããªãLoRAã«ãªã£ãŠããŸãå¯èœæ§ãããã®ã§æ°ãã€ããŸãããã
ããã©ã«ãã¯0ã§ã0ã®å Žåã¯ãã£ãã·ã§ã³ã®[ããããã¢ãŠã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25C9%25A5%25ED%25A5%25C3%25A5%25D7%25A5%25A2%25A5%25A6%25A5%25C8)ãè¡ããŸããã
Rate of caption dropout
äžèšã®Dropout caption every n epochsãšäŒŒãŠããŸãããåŠç¿ã®å šå·¥çšã®ãã¡ãããäžå®ã®å²åã ããã£ãã·ã§ã³ã䜿ããããã£ãã·ã§ã³ãªãã®ç»åããšããŠåŠç¿ãããããšãã§ããŸãã
ããã§ãã£ãã·ã§ã³ãªãç»åã®å²åãèšå®ã§ããŸãã0ã¯ãåŠç¿äžå¿ ããã£ãã·ã§ã³ã䜿ããèšå®ã1ã¯ãåŠç¿äžãã£ãã·ã§ã³ãå šã䜿ããªããèšå®ã§ãã
ã©ã®ç»åãããã£ãã·ã§ã³ãªãç»åããšããŠåŠç¿ããããã¯ã©ã³ãã ã«æ±ºãŸããŸãã
äŸãã°ãç»å20æããããã50åèªã¿èŸŒãLoRAåŠç¿ã1ãšããã¯ã ãè¡ãå Žåãç»ååŠç¿ã®ç·æ°ã¯20æx50åx1ãšããã¯=1000åã§ãããã®æRate of caption dropoutã0.1ã«èšå®ãããšã1000åx0.1=100åã¯ããã£ãã·ã§ã³ãªãã®ç»åããšããŠåŠç¿ãè¡ããŸãã
ããã©ã«ãã¯0ã§ããã¹ãŠã®ç»åããã£ãã·ã§ã³ä»ãã§åŠç¿ããŸãã
VAE batch size
Cache latentsãªãã·ã§ã³ããªã³ã«ãããšãå§çž®ãããç¶æ ã®ç»åããŒã¿ãã¡ã€ã³ã¡ã¢ãªã«ä¿æããŠããããšãã§ããŸããããã®ãå§çž®ãç»åãäœæäžçµã§ä¿æããããèšå®ããã®ãVAE batch sizeã§ããããããµã€ãº(Batch size)ã§æå®ããç»åææ°ãäžåºŠã«åŠç¿ããã®ã§ãVAE batch sizeãããã«åãããã®ãæ®éã§ãã
ããã©ã«ãã¯0ã§ããã®å ŽåBatch sizeãšåãæ°å€ã«èšå®ãããŸãã
Save training state
åŠç¿ç»åãç¹°ãè¿ãæ°ããšããã¯æ°ãå€ããšLoRAã®åŠç¿ã«é·ãæéãããããŸãã
ãã®ãªãã·ã§ã³ããªã³ã«ãããšãåŠç¿ãéäžã§äžæããŠåŸæ¥ç¶ãããåŠç¿ãåéããããšãã§ããŸãã
åŠç¿ã®éäžçµéããŒã¿ã¯ãlast-stateããšãããã©ã«ãã«ä¿åãããŸãã
Resume from saved training state
äžæããåŠç¿ãåéãããå Žåãããã«ãlast-stateããã©ã«ãã®å Žæãæå®ããŸãã
åŠç¿ãåéããã«ã¯ãåŠç¿ã®éäžçµéããŒã¿ãä¿åãããŠããå¿ èŠããããŸãã
Max train epoch
åŠç¿ã®ããã®æ倧ãšããã¯æ°ãæå®ããŸããEpochãªãã·ã§ã³ã§ãšããã¯æ°ãæå®ããã®ãåºæ¬ã§ãããããã§æå®ãããšããã¯æ°ã«éãããšå¿ ãåŠç¿ãçµäºããŸãã
ããã©ã«ãã¯ç©ºæ¬ã§ãã空æ¬ã®ãŸãŸã§æ§ããŸããã
Max num workers for DataLoader
åŠç¿ã®ããã®ããŒã¿ãèªã¿èŸŒãæã«äœ¿çšããCPUããã»ã¹æ°ãæå®ãããªãã·ã§ã³ã§ãããã®æ°å€ãäžããããšã«ãµãããã»ã¹ãæå¹ã«ãªãããŒã¿ã®èªã¿èŸŒã¿ã¹ããŒããäžãããŸãããæ°åãäžãããããšããã£ãŠéå¹çã«ãªãå ŽåããããŸãã
ãªããã©ãã ã倧ããæ°åãæå®ããŠãã䜿çšCPUã®åæå®è¡ã¹ã¬ããæ°ä»¥äžã«ã¯ãªããŸããã
ããã©ã«ãã¯0ã§ãCPUã®ã¡ã€ã³ããã»ã¹ã§ã®ã¿ããŒã¿èªã¿èŸŒã¿ãè¡ããŸãã
WANDB [API](https://translate.google.com/website?sl=auto&tl=en&hl=en-
US&client=webapp&u=https://d.hatena.ne.jp/keyword/API) Key
ã[WandB](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://wandb.ai/site)ã(Weights&Biases)ãšãã[æ©æ¢°åŠç¿](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25B5%25A1%25B3%25A3%25B3%25D8%25BD%25AC)ãµãŒãã¹ããããŸããããã¯æé©ãªèšå®ãèŠã€ããããã«åŠç¿ã®é²è¡ç¶æ³ãã°ã©ãã§è¡šç€ºãããåŠç¿ãã°ãªã©ããªã³ã©ã€ã³ã§èšé²ãå ±æãããµãŒãã¹ã§ãããkohya_ssã§ããã®ãµãŒãã¹ã䜿çšã§ããããã«ãªããŸããã
ãã ããã®ãµãŒãã¹ã®ã¢ã«ãŠã³ããå¿ èŠã§ããã¢ã«ãŠã³ããäœæããåŸã[https://app.wandb.ai/authorize](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://app.wandb.ai/authorize)ããã[API](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/API) keyããååŸã§ããŸããååŸãã[API](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/API)ããŒãããã«å ¥åããŠãããšãåŠç¿æã«èªåçã«ãã°ã€ã³ããWandBã®ãµãŒãã¹ãšé£åã§ããããã«ãªããŸãã
WandBã«é¢ãã詳现ã¯çããŸããããLoRAè·äººããç®æã人ã¯è©ŠããŠã¿ãŸãããã
WANDB Logging
åŠç¿ç¶æ³ã®ãã°ãWandBãµãŒãã¹ã䜿ã£ãŠèšé²ãããã©ãããããã§æå®ã§ããŸãã
ããã©ã«ãã¯ãªãã§ããªãã®å Žåã¯ãtensorboardããšããããŒã«ã®åœ¢åŒã§ãã°ãèšé²ããŸãã
Sample images config
LoRAã䜿ã£ãç»åçæãã©ããªæãã«ãªãã®ãåŠç¿éäžã§ãã§ãã¯ãããå Žåãããã§ç»åçæããã³ãããå ¥åããŸãã
ãã ãLoRAã¯æ¯èŒçåŠç¿æéãçãã®ã§ãç»åçæãã¹ãã®å¿ èŠã¯ããŸããªããããããŸããã
Sample every n steps
åŠç¿äžãäœã¹ãããç®ã«ç»åãçæãããã®ããæå®ããŸããäŸãã°100ãšæå®ãããšã100ã¹ãããããšã«ç»åãçæããŸãã
ããã©ã«ãã¯0ã§ã0ã®å Žåã¯ç»åãçæããŸããã
Sample every n epochs
åŠç¿äžãäœãšããã¯ç®ã«ç»åãçæãããã®ããæå®ããŸããäŸãã°2ãšæå®ãããšã2ãšããã¯ããšã«ç»åãçæããŸãã
ããã©ã«ãã¯0ã§ã0ã®å Žåã¯ç»åãçæããŸããã
Sample sampler
ç»åçæã«äœ¿ã[ãµã³ãã©ãŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25B5%25A5%25F3%25A5%25D7%25A5%25E9%25A1%25BC)ãæå®ããŸããããã§æå®ãã[ãµã³ãã©ãŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25B5%25A5%25F3%25A5%25D7%25A5%25E9%25A1%25BC)ã®å€ãã¯Stable Diffusion Web UIã§çšæãããŠãã[ãµã³ãã©ãŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25B5%25A5%25F3%25A5%25D7%25A5%25E9%25A1%25BC)ãšåããªã®ã§ã詳现ã¯Web UIã®èª¬æãµã€ããåç §ããŠãã ããã
ããã©ã«ãã¯euler_aã§ãã
Sample prompts
ããã§ããã³ãããå ¥åããŸãã
ãã ãããã«ã¯ããã³ããã ãã§ãªãä»ã®èšå®ãå ¥åã§ããŸããã»ãã®èšå®ãå ¥åããå Žåã¯ã--nãã®ããã«ãã€ãã¹2ã€ãšã¢ã«ãã¡ããããçµã¿åãããŠèšå®ãæå®ããŸããäŸãã°ãã¬ãã£[ãããã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D6%25A5%25D7%25A5%25ED%25A5%25F3)ããã«ãwhite, dogããšå ¥ãããå Žåãã--n white, dogããšæžããŸãã
ãã䜿ããããªèšå®ã®æå®ã¯ä»¥äžã®éãã§ãã
--nïŒãã¬ãã£[ãããã³](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25A5%25D6%25A5%25D7%25A5%25ED%25A5%25F3)ãã
--wïŒç»åã®å¹
--hïŒç»åã®é«ã
--dïŒSeed
--lïŒCFG Scale
--sïŒã¹ãããæ°
ããã©ã«ãã¯ç©ºæ¬ã§ãã空æ¬ã®æã«èšè¿°äŸãèã衚瀺ãããŠããã®ã§ããããåèã«ããŠãã ããã
ãŸãšã
Stable Diffusionã®è¿œå åŠç¿ã®ã²ãšã€ã§ããLoRAã®ããã¿ãšãLoRAåŠç¿ãè¡ãããŒã«ã§ããkohya_ssã®åèšå®ã«ã€ããŠè§£èª¬ããŸããã
èšå®ããé ç®ãéåžžã«å€ãã®ã§æ··ä¹±ãããã§ããããŸãã¯æšå¥šèšå®ã§è»œãåŠç¿ããŠãåŠç¿çµæã«å¿ããŠå°ããã€èšå®ãå€ããŠããããã«ããŸãããã
ããã§ã®è§£èª¬ãåèã«ããŠãããã«é«ã粟床ã®LoRAäœæãç®æããŠã¿ãŠãã ããã
[ Stable Diffusion ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/Stable%2520Diffusion?from%3Dhatenablog%26utm_source%3Dhoshikat.hatenablog.com%26utm_medium%3Dhatenablog%26utm_campaign%3Dblogtag%26utm_term%3DStable%2BDiffusion%26utm_content%3D%252Fentry%252F2023%252F05%252F26%252F223229) [ ãçµµæãAI ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/%25E3%2581%258A%25E7%25B5%25B5%25E6%258F%258F%25E3%2581%258DAI?from%3Dhatenablog%26utm_source%3Dhoshikat.hatenablog.com%26utm_medium%3Dhatenablog%26utm_campaign%3Dblogtag%26utm_term%3D%25E3%2581%258A%25E7%25B5%25B5%25E6%258F%258F%25E3%2581%258DAI%26utm_content%3D%252Fentry%252F2023%252F05%252F26%252F223229) [ LoRA ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/LoRA?from%3Dhatenablog%26utm_source%3Dhoshikat.hatenablog.com%26utm_medium%3Dhatenablog%26utm_campaign%3Dblogtag%26utm_term%3DLoRA%26utm_content%3D%252Fentry%252F2023%252F05%252F26%252F223229) [ kohya_ss ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://d.hatena.ne.jp/keyword/kohya_ss?from%3Dhatenablog%26utm_source%3Dhoshikat.hatenablog.com%26utm_medium%3Dhatenablog%26utm_campaign%3Dblogtag%26utm_term%3Dkohya_ss%26utm_content%3D%252Fentry%252F2023%252F05%252F26%252F223229)
hoshikat [2023-05-26 22:32](https://hoshikat-hatenablog- com.translate.goog/entry/2023/05/26/223229?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
[![ãã®èšäºãã¯ãŠãªããã¯ããŒã¯ã«è¿œå ](https://b.st-hatena.com/images/entry-button/button- only.gif)](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://b.hatena.ne.jp/entry/s/hoshikat.hatenablog.com/entry/2023/05/26/223229 "ãã®èšäºãã¯ãŠãªããã¯ããŒã¯ã«è¿œå ")
[Tweet](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://twitter.com/share)
[åºåãé衚瀺ã«ãã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=http://blog.hatena.ne.jp/guide/pro)
é¢é£èšäº
[ 2023-06-13 ](https://hoshikat-hatenablog- com.translate.goog/archive/2023/06/13?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
[誰ã§ããããStable Diffusion ããã¹ããšã³ã³ãŒããŒïŒCLIPã®ããã¿](https://hoshikat-hatenablog- com.translate.goog/entry/2023/06/13/002443?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
以åã®èšäºã§Stable Diffusionãã©ã®ããã«çµµãæããŠãããé âŠ
[ 2023-06-07 ](https://hoshikat-hatenablog- com.translate.goog/archive/2023/06/07?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
[誰ã§ããããStable Diffusion LoRAãäœã£ãŠã¿ãã(å®è·µç·š)](https://hoshikat-hatenablog- com.translate.goog/entry/2023/06/07/215433?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
以åã®èšäºã§LoRAãäœãããã®Kohya_sså°å ¥ã®è§£èª¬ãæžããŸãã*âŠ
[ 2023-05-05 ](https://hoshikat-hatenablog- com.translate.goog/archive/2023/05/05?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
[誰ã§ããããStable Diffusion LoRAãäœã£ãŠã¿ãã(å°å ¥ç·š)](https://hoshikat-hatenablog- com.translate.goog/entry/2023/05/05/013600?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
Stable Diffusionã¯ãã®ãŸãŸã§ãååããããªç»åãæããŠããâŠ
[ 2023-04-12 ](https://hoshikat-hatenablog- com.translate.goog/archive/2023/04/12?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
[誰ã§ããããStable Diffusion ãã®6ïŒU-Net(IN1ãResãããã¯)](https://hoshikat-hatenablog- com.translate.goog/entry/2023/04/12/003127?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
Stable Diffusionã®U-Net解説ã®3åç®ã§ãã ä»åã¯IN1ãããã¯âŠ
[ 2023-04-03 ](https://hoshikat-hatenablog- com.translate.goog/archive/2023/04/03?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
[誰ã§ããããStable diffusion ãã®5ïŒU-Net(IN0ãããã¯ãšç³ã¿èŸŒã¿)](https://hoshikat-hatenablog- com.translate.goog/entry/2023/04/03/215537?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
Stable Diffusionã§äœ¿ãããU-Netã®æåã®ãããã¯ãIN0å±€ã«ã€âŠ
- ãã£ãšèªã
ã³ã¡ã³ããæžã
[ « 誰ã§ããããStable Diffusion LoRAãäœâŠ ](https://hoshikat-hatenablog- com.translate.goog/entry/2023/06/07/215433?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp) [ AIãçµµæãããããåé¡ ãããŸã§ãšãã⊠» ](https://hoshikat-hatenablog- com.translate.goog/entry/2023/05/17/183410?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
ãããã£ãŒã«
[ ![id:hoshikat](https://cdn.profile-image.st- hatena.com/users/hoshikat/profile.png) ](https://hoshikat-hatenablog- com.translate.goog/about?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp) [id:hoshikat](https://hoshikat-hatenablog- com.translate.goog/about?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
[ èªè ã§ã èªè ãããã èªè ã«ãªã èªè ã«ãªã ](https://hoshikat-hatenablog- com.translate.goog/entry/2023/05/26/223229?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp#)
[ãã®ããã°ã«ã€ããŠ](https://hoshikat-hatenablog- com.translate.goog/about?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
æ€çŽ¢
ãªã³ã¯
[ ææ°èšäº ](https://hoshikat-hatenablog- com.translate.goog/archive?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
誰ã§ããããStable Diffusion ãªãŒãžã§ãã«ããã³ãã
誰ã§ããããStable Diffusion CFGã¹ã±ãŒã«ã®ããã¿
誰ã§ããããStable Diffusion ããã¹ããšã³ã³ãŒããŒïŒCLIPã®ããã¿
誰ã§ããããStable Diffusion LoRAãäœã£ãŠã¿ãã(å®è·µç·š)
[æå¥ã¢ãŒã«ã€ã](https://hoshikat-hatenablog- com.translate.goog/archive?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
- ⌠â¶
[ 2023 ](https://hoshikat-hatenablog- com.translate.goog/archive/2023?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp)
* [ 2023 / 7 ](https://hoshikat-hatenablog-com.translate.goog/archive/2023/7?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp)
* [ 2023 / 6 ](https://hoshikat-hatenablog-com.translate.goog/archive/2023/6?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp)
* [ 2023 / 5 ](https://hoshikat-hatenablog-com.translate.goog/archive/2023/5?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp)
* [ 2023 / 4 ](https://hoshikat-hatenablog-com.translate.goog/archive/2023/4?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp)
* [ 2023 / 3 ](https://hoshikat-hatenablog-com.translate.goog/archive/2023/3?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp)
ã¯ãŠãªããã°ãã¯ããããïŒ
hoshikatããã¯ãã¯ãŠãªããã°ã䜿ã£ãŠããŸããããªããã¯ãŠãªããã°ãã¯ãããŠã¿ãŸãããïŒ
[ã¯ãŠãªããã°ãã¯ãããïŒç¡æïŒ](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://blog.hatena.ne.jp/register?via%3D200227)
[ã¯ãŠãªããã°ãšã¯](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://hatenablog.com/guide)
[ ![人工ç¥èœãšèŠªãããªãããã°](https://cdn.image.st- hatena.com/image/square/956bbfe235ea19a9079dd050f7013fea30fe3aa5/backend=imagemagick;height=128;version=1;width=128/https%3A%2F%2Fcdn.user.blog.st- hatena.com%2Fblog_custom_icon%2F159049220%2F1684744907210605) 人工ç¥èœãšèŠªãããªãããã° ](https://hoshikat-hatenablog- com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp)
Powered by [Hatena Blog](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://hatenablog.com/) | [ããã°ãå ±åãã](https://translate.google.com/website?sl=auto&tl=en&hl=en- US&client=webapp&u=https://blog.hatena.ne.jp/-/abuse_report?target_url%3Dhttps%253A%252F%252Fhoshikat.hatenablog.com%252Fentry%252F2023%252F05%252F26%252F223229)
__
__
åŒçšãã¹ããã¯ããŸãã
ã¹ããã¯äžèŠ§ãèŠã éãã
åŒçšããã«ã¯ãŸããã°ã€ã³ããŠãã ãã
ãã°ã€ã³ éãã
åŒçšãã¹ããã¯ã§ããŸããã§ãããå床ãè©Šããã ãã
éãã
éå®å ¬éèšäºã®ããåŒçšã§ããŸããã
[ èªè ã§ã èªè ãããã èªè ã«ãªã èªè ã«ãªã ](https://hoshikat-hatenablog- com.translate.goog/entry/2023/05/26/223229?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en- US&_x_tr_pto=wapp#)