Skip to content

Commit 81e6ad7

Browse files
committed
Anima leco and addift support
From tukisuwa#1
2 parents 3fc6086 + 794c6b8 commit 81e6ad7

14 files changed

Lines changed: 3511 additions & 50 deletions

README-ja.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<summary>クリックすると展開します</summary>
99

1010
- [はじめに](#はじめに)
11+
- [このフォークでの主な追加](#このフォークでの主な追加)
1112
- [スポンサー](#スポンサー)
1213
- [スポンサー募集のお知らせ](#スポンサー募集のお知らせ)
1314
- [更新履歴](#更新履歴)
@@ -36,6 +37,14 @@
3637

3738
Stable Diffusion等の画像生成モデルの学習、モデルによる画像生成、その他のスクリプトを入れたリポジトリです。
3839

40+
### このフォークでの主な追加
41+
42+
このフォークでは、本家 sd-scripts に加えて、以下の実験的な機能を追加しています。
43+
44+
* **Anima iLECO学習**: Anima 向けの prompt-to-prompt edit LoRA 学習です。詳しくは [Anima iLECO学習](./docs/anima_train_leco.md) を参照してください。
45+
* **Anima ADDifT学習**: source/target の画像ペアから Anima 向け edit LoRA を学習します。詳しくは [Anima ADDifT学習](./docs/anima_train_addift.md) を参照してください。
46+
* **アーキテクチャ非依存 LoRA マージツール**: sd-scripts 形式の LoRA 差分を再構成し、SVD で再分解して複数 LoRA を合成します。詳しくは [アーキテクチャ非依存 LoRA マージツール](./docs/merger.md) を参照してください。
47+
3948
### スポンサー
4049

4150
このプロジェクトを支援してくださる企業・団体の皆様に深く感謝いたします。
@@ -110,6 +119,8 @@ Stable Diffusion等の画像生成モデルの学習、モデルによる画像
110119
* [FLUX.1学習](./docs/flux_train_network.md)
111120
* [LUMINA学習](./docs/lumina_train_network.md)
112121
* [HunyuanImage-2.1学習](./docs/hunyuan_image_train_network.md)
122+
* [Anima iLECO学習](./docs/anima_train_leco.md)
123+
* [Anima ADDifT学習](./docs/anima_train_addift.md)
113124
* [Fine-tuning](./docs/fine_tune.md)
114125
* [Textual Inversion学習](./docs/train_textual_inversion.md)
115126
* [ControlNet-LLLite学習](./docs/train_lllite_README-ja.md) / [英語版](./docs/train_lllite_README.md)
@@ -121,6 +132,7 @@ Stable Diffusion等の画像生成モデルの学習、モデルによる画像
121132

122133
* [画像生成スクリプト](./docs/gen_img_README-ja.md) / [英語版](./docs/gen_img_README.md)
123134
* [WD14 Taggerによる画像タグ付け](./docs/wd14_tagger_README-ja.md) / [英語版](./docs/wd14_tagger_README-en.md)
135+
* [アーキテクチャ非依存 LoRA マージツール](./docs/merger.md)
124136

125137
### 旧ドキュメント(日本語)
126138

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<summary>Click to expand</summary>
88

99
- [Introduction](#introduction)
10+
- [Fork-specific Additions](#fork-specific-additions)
1011
- [Supported Models](#supported-models)
1112
- [Features](#features)
1213
- [Sponsors](#sponsors)
@@ -33,6 +34,14 @@
3334

3435
This repository contains training, generation and utility scripts for Stable Diffusion and other image generation models.
3536

37+
### Fork-specific Additions
38+
39+
This fork adds several experimental tools on top of upstream sd-scripts:
40+
41+
* **Anima iLECO training**: prompt-to-prompt edit LoRA training for Anima. See [Anima iLECO Training](./docs/anima_train_leco.md).
42+
* **Anima ADDifT training**: paired-image edit LoRA training for Anima, using source/target image folders. See [Anima ADDifT Training](./docs/anima_train_addift.md).
43+
* **Architecture-agnostic LoRA merger**: merges sd-scripts style LoRA files by reconstructing LoRA deltas and recomposing them with SVD. See [Architecture-agnostic LoRA merger](./docs/merger.md).
44+
3645
### Sponsors
3746

3847
We are grateful to the following companies for their generous sponsorship:
@@ -105,6 +114,8 @@ If you find this project helpful, please consider supporting its development via
105114
* [FLUX.1 Training](./docs/flux_train_network.md)
106115
* [LUMINA Training](./docs/lumina_train_network.md)
107116
* [HunyuanImage-2.1 Training](./docs/hunyuan_image_train_network.md)
117+
* [Anima iLECO Training](./docs/anima_train_leco.md)
118+
* [Anima ADDifT Training](./docs/anima_train_addift.md)
108119
* [Fine-tuning](./docs/fine_tune.md)
109120
* [Textual Inversion Training](./docs/train_textual_inversion.md)
110121
* [ControlNet-LLLite Training](./docs/train_lllite_README.md) / [Japanese version](./docs/train_lllite_README-ja.md)
@@ -116,6 +127,7 @@ If you find this project helpful, please consider supporting its development via
116127

117128
* [Image generation](./docs/gen_img_README.md) / [Japanese version](./docs/gen_img_README-ja.md)
118129
* [Tagging images with WD14 Tagger](./docs/wd14_tagger_README-en.md) / [Japanese version](./docs/wd14_tagger_README-ja.md)
130+
* [Architecture-agnostic LoRA merger](./docs/merger.md)
119131

120132
## For Developers Using AI Coding Agents
121133

anima_train_addift.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Anima ADDifT training script
2+
3+
from library import train_util
4+
from library.device_utils import init_ipex
5+
6+
init_ipex()
7+
8+
import anima_train_network
9+
10+
11+
def main() -> None:
12+
parser = anima_train_network.setup_parser()
13+
args = parser.parse_args()
14+
if args.ileco:
15+
raise ValueError("anima_train_addift.py cannot be used with --ileco")
16+
args.addift = True
17+
18+
train_util.verify_command_line_training_args(args)
19+
args = train_util.read_config_from_file(args, parser)
20+
21+
if args.dataset_config is None:
22+
raise ValueError("--dataset_config is required for anima_train_addift.py")
23+
if args.ileco:
24+
raise ValueError("anima_train_addift.py cannot be used with --ileco")
25+
args.addift = True
26+
27+
if args.attn_mode == "sdpa":
28+
args.attn_mode = "torch" # backward compatibility
29+
30+
trainer = anima_train_network.AnimaNetworkTrainer()
31+
trainer.train(args)
32+
33+
34+
if __name__ == "__main__":
35+
main()

0 commit comments

Comments
 (0)