Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.8.6 #1212

Merged
merged 98 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
dfe08f3
support deepspeed
BootsofLagrangian Feb 3, 2024
64873c1
fix offload_optimizer_device typo
BootsofLagrangian Feb 5, 2024
2824312
fix vae type error during training sdxl
BootsofLagrangian Feb 5, 2024
4295f91
fix all trainer about vae
BootsofLagrangian Feb 5, 2024
3970bf4
maybe fix branch to run offloading
BootsofLagrangian Feb 5, 2024
7d2a926
apply offloading method runable for all trainer
BootsofLagrangian Feb 5, 2024
6255661
fix full_fp16 compatible and train_step
BootsofLagrangian Feb 7, 2024
2445a5b
remove test requirements
BootsofLagrangian Feb 7, 2024
a98feca
forgot setting mixed_precision for deepspeed. sorry
BootsofLagrangian Feb 7, 2024
03f0816
the reason not working grad accum steps found. it was becasue of my a…
BootsofLagrangian Feb 9, 2024
4d5186d
refactored codes, some function moved into train_utils.py
BootsofLagrangian Feb 22, 2024
577e991
add some new dataset settings
kohya-ss Feb 26, 2024
f2c727f
add minimal impl for masked loss
kohya-ss Feb 26, 2024
1751936
update readme
kohya-ss Feb 26, 2024
4a5546d
fix typo
kohya-ss Feb 26, 2024
074d32a
Merge branch 'main' into dev
kohya-ss Feb 27, 2024
eefb3cc
Merge branch 'deep-speed' into deepspeed
kohya-ss Feb 27, 2024
0e4a573
Merge pull request #1101 from BootsofLagrangian/deepspeed
kohya-ss Feb 27, 2024
e3ccf8f
make deepspeed_utils
kohya-ss Feb 27, 2024
a9b64ff
support masked loss in sdxl_train ref #589
kohya-ss Feb 27, 2024
14c9372
add doc about Colab/rich issue
kohya-ss Mar 3, 2024
124ec45
Add "encoding='utf-8'"
Horizon1704 Mar 10, 2024
095b803
save state on train end
gesen2egee Mar 10, 2024
d282c45
Update train_network.py
gesen2egee Mar 11, 2024
74c266a
Merge branch 'dev' into masked-loss
kohya-ss Mar 12, 2024
97524f1
Merge branch 'dev' into deep-speed
kohya-ss Mar 12, 2024
948029f
random ip_noise_gamma strength
KohakuBlueleaf Mar 12, 2024
8639940
random noise_offset strength
KohakuBlueleaf Mar 12, 2024
53954a1
use correct settings for parser
KohakuBlueleaf Mar 12, 2024
0a8ec52
Merge branch 'main' into dev
kohya-ss Mar 15, 2024
443f029
fix doc
kohya-ss Mar 15, 2024
0ef4fe7
Merge branch 'dev' into masked-loss
kohya-ss Mar 17, 2024
7081a0c
extension of src image could be different than target image
kohya-ss Mar 17, 2024
3419c3d
common masked loss func, apply to all training script
kohya-ss Mar 17, 2024
86e40fa
Merge branch 'dev' into deep-speed
kohya-ss Mar 17, 2024
a7dff59
Update tag_images_by_wd14_tagger.py
sdbds Mar 18, 2024
5410a8c
Update requirements.txt
sdbds Mar 18, 2024
a71c35c
Update requirements.txt
sdbds Mar 18, 2024
6c51c97
fix typo
sdbds Mar 20, 2024
e281e86
Merge branch 'main' into dev
kohya-ss Mar 20, 2024
7da41be
Merge pull request #1192 from sdbds/main
kohya-ss Mar 20, 2024
80dbbf5
tagger now stores model under repo_id subdir
kohya-ss Mar 20, 2024
cf09c6a
Merge pull request #1177 from KohakuBlueleaf/random-strength-noise
kohya-ss Mar 20, 2024
46331a9
English Translation of config_README-ja.md (#1175)
darkstorm2150 Mar 20, 2024
5f6196e
update readme
kohya-ss Mar 20, 2024
119cc99
Merge pull request #1167 from Horizon1704/patch-1
kohya-ss Mar 20, 2024
3b0db0f
update readme
kohya-ss Mar 20, 2024
bf6cd4b
Merge pull request #1168 from gesen2egee/save_state_on_train_end
kohya-ss Mar 20, 2024
855add0
update option help and readme
kohya-ss Mar 20, 2024
9b6b39f
Merge branch 'dev' into masked-loss
kohya-ss Mar 20, 2024
fbb98f1
Merge branch 'dev' into deep-speed
kohya-ss Mar 20, 2024
d945602
Fix most of ZeRO stage uses optimizer partitioning
BootsofLagrangian Mar 20, 2024
a35e7bd
Merge pull request #1200 from BootsofLagrangian/deep-speed
kohya-ss Mar 20, 2024
d17c0f5
update dataset config doc
kohya-ss Mar 20, 2024
594c7f7
format by black
kohya-ss Mar 23, 2024
f4a4c11
support multiline captions ref #1155
kohya-ss Mar 23, 2024
0c7baea
register reg images with correct subset
feffy380 Mar 23, 2024
79d1c12
disable sample_every_n_xxx if value less than 1 ref #1202
kohya-ss Mar 24, 2024
691f043
update readme
kohya-ss Mar 24, 2024
ad97410
Merge pull request #1205 from feffy380/patch-1
kohya-ss Mar 24, 2024
381c449
update readme and typing hint
kohya-ss Mar 24, 2024
ae97c8b
[Experimental] Add cache mechanism for dataset groups to avoid long w…
KohakuBlueleaf Mar 24, 2024
0253472
refactor metadata caching for DreamBooth dataset
kohya-ss Mar 24, 2024
8d58588
Merge branch 'dev' into masked-loss
kohya-ss Mar 24, 2024
993b2ab
Merge branch 'dev' into deep-speed
kohya-ss Mar 24, 2024
1648ade
format by black
kohya-ss Mar 24, 2024
9bbb28c
update PyTorch version and reorganize dependencies
kohya-ss Mar 24, 2024
9c4492b
fix pytorch version 2.1.1 to 2.1.2
kohya-ss Mar 24, 2024
c24422f
Merge branch 'dev' into deep-speed
kohya-ss Mar 25, 2024
a2b8531
make each script consistent, fix to work w/o DeepSpeed
kohya-ss Mar 25, 2024
ea05e3f
Merge pull request #1139 from kohya-ss/deep-speed
kohya-ss Mar 26, 2024
ab1e389
Merge branch 'dev' into masked-loss
kohya-ss Mar 26, 2024
5a2afb3
Merge pull request #1207 from kohya-ss/masked-loss
kohya-ss Mar 26, 2024
c86e356
Merge branch 'dev' into dataset-cache
kohya-ss Mar 26, 2024
78e0a76
Merge pull request #1206 from kohya-ss/dataset-cache
kohya-ss Mar 26, 2024
6c08e97
update readme
kohya-ss Mar 26, 2024
6f7e93d
Add OpenVINO and ROCm ONNX Runtime for WD14
Disty0 Mar 27, 2024
b86af67
Merge pull request #1213 from Disty0/dev
kohya-ss Mar 27, 2024
dd9763b
Rating support for WD Tagger
Disty0 Mar 27, 2024
954731d
fix typo
Disty0 Mar 27, 2024
4012fd2
IPEX fix pin_memory
Disty0 Mar 28, 2024
bc586ce
Add --use_rating_tags and --character_tags_first for WD Tagger
Disty0 Mar 29, 2024
f1f30ab
fix to work with num_beams>1 closes #1149
kohya-ss Mar 30, 2024
ae3f625
Merge branch 'dev' of https://github.com/kohya-ss/sd-scripts into dev
kohya-ss Mar 30, 2024
434dc40
update readme
kohya-ss Mar 30, 2024
6ba8428
Merge pull request #1216 from Disty0/dev
kohya-ss Mar 30, 2024
cae5aa0
update wd14 tagger and doc
kohya-ss Mar 30, 2024
f5323e3
update tagger doc
kohya-ss Mar 30, 2024
2c2ca9d
update tagger doc
kohya-ss Mar 30, 2024
059ee04
fix typo
kohya-ss Mar 30, 2024
2258a1b
add save/load hook to remove U-Net/TEs from state
kohya-ss Mar 31, 2024
b748b48
fix attention couple+deep shink cause error in some reso
kohya-ss Apr 3, 2024
cd587ce
verify command line args if wandb is enabled
kohya-ss Apr 4, 2024
921036d
Merge pull request #1240 from kohya-ss/verify-command-line-args
kohya-ss Apr 7, 2024
089727b
update readme
kohya-ss Apr 7, 2024
90b1879
Add option to use Scheduled Huber Loss in all training pipelines to i…
kabachuha Apr 7, 2024
d30ebb2
update readme, add metadata for network module
kohya-ss Apr 7, 2024
dfa3079
update readme
kohya-ss Apr 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 50 additions & 47 deletions README-ja.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
SDXLがサポートされました。sdxlブランチはmainブランチにマージされました。リポジトリを更新したときにはUpgradeの手順を実行してください。また accelerate のバージョンが上がっていますので、accelerate config を再度実行してください。

SDXL学習については[こちら](./README.md#sdxl-training)をご覧ください(英語です)。

## リポジトリについて
Stable Diffusionの学習、画像生成、その他のスクリプトを入れたリポジトリです。

Expand All @@ -21,6 +17,7 @@ GUIやPowerShellスクリプトなど、より使いやすくする機能が[bma

* [学習について、共通編](./docs/train_README-ja.md) : データ整備やオプションなど
* [データセット設定](./docs/config_README-ja.md)
* [SDXL学習](./docs/train_SDXL-en.md) (英語版)
* [DreamBoothの学習について](./docs/train_db_README-ja.md)
* [fine-tuningのガイド](./docs/fine_tune_README_ja.md):
* [LoRAの学習について](./docs/train_network_README-ja.md)
Expand All @@ -44,9 +41,7 @@ PowerShellを使う場合、venvを使えるようにするためには以下の

## Windows環境でのインストール

スクリプトはPyTorch 2.0.1でテストしています。PyTorch 1.12.1でも動作すると思われます。

以下の例ではPyTorchは2.0.1/CUDA 11.8版をインストールします。CUDA 11.6版やPyTorch 1.12.1を使う場合は適宜書き換えください。
スクリプトはPyTorch 2.1.2でテストしています。PyTorch 2.0.1、1.12.1でも動作すると思われます。

(なお、python -m venv~の行で「python」とだけ表示された場合、py -m venv~のようにpythonをpyに変更してください。)

Expand All @@ -59,20 +54,20 @@ cd sd-scripts
python -m venv venv
.\venv\Scripts\activate

pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 --index-url https://download.pytorch.org/whl/cu118
pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
pip install --upgrade -r requirements.txt
pip install xformers==0.0.20
pip install xformers==0.0.23.post1 --index-url https://download.pytorch.org/whl/cu118

accelerate config
```

コマンドプロンプトでも同一です。

(注:``python -m venv venv`` のほうが ``python -m venv --system-site-packages venv`` より安全そうなため書き換えました。globalなpythonにパッケージがインストールしてあると、後者だといろいろと問題が起きます。)
注:`bitsandbytes==0.43.0`、`prodigyopt==1.0`、`lion-pytorch==0.0.6` は `requirements.txt` に含まれるようになりました。他のバージョンを使う場合は適宜インストールしてください。

accelerate configの質問には以下のように答えてください。(bf16で学習する場合、最後の質問にはbf16と答えてください。)
この例では PyTorch および xfomers は2.1.2/CUDA 11.8版をインストールします。CUDA 12.1版やPyTorch 1.12.1を使う場合は適宜書き換えください。たとえば CUDA 12.1版の場合は `pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121` および `pip install xformers==0.0.23.post1 --index-url https://download.pytorch.org/whl/cu121` としてください。

※0.15.0から日本語環境では選択のためにカーソルキーを押すと落ちます(……)。数字キーの0、1、2……で選択できますので、そちらを使ってください。
accelerate configの質問には以下のように答えてください。(bf16で学習する場合、最後の質問にはbf16と答えてください。)

```txt
- This machine
Expand All @@ -87,41 +82,6 @@ accelerate configの質問には以下のように答えてください。(bf1
※場合によって ``ValueError: fp16 mixed precision requires a GPU`` というエラーが出ることがあるようです。この場合、6番目の質問(
``What GPU(s) (by id) should be used for training on this machine as a comma-separated list? [all]:``)に「0」と答えてください。(id `0`のGPUが使われます。)

### オプション:`bitsandbytes`(8bit optimizer)を使う

`bitsandbytes`はオプションになりました。Linuxでは通常通りpipでインストールできます(0.41.1または以降のバージョンを推奨)。

Windowsでは0.35.0または0.41.1を推奨します。

- `bitsandbytes` 0.35.0: 安定しているとみられるバージョンです。AdamW8bitは使用できますが、他のいくつかの8bit optimizer、学習時の`full_bf16`オプションは使用できません。
- `bitsandbytes` 0.41.1: Lion8bit、PagedAdamW8bit、PagedLion8bitをサポートします。`full_bf16`が使用できます。

注:`bitsandbytes` 0.35.0から0.41.0までのバージョンには問題があるようです。 https://github.com/TimDettmers/bitsandbytes/issues/659

以下の手順に従い、`bitsandbytes`をインストールしてください。

### 0.35.0を使う場合

PowerShellの例です。コマンドプロンプトではcpの代わりにcopyを使ってください。

```powershell
cd sd-scripts
.\venv\Scripts\activate
pip install bitsandbytes==0.35.0

cp .\bitsandbytes_windows\*.dll .\venv\Lib\site-packages\bitsandbytes\
cp .\bitsandbytes_windows\cextension.py .\venv\Lib\site-packages\bitsandbytes\cextension.py
cp .\bitsandbytes_windows\main.py .\venv\Lib\site-packages\bitsandbytes\cuda_setup\main.py
```

### 0.41.1を使う場合

jllllll氏の配布されている[こちら](https://github.com/jllllll/bitsandbytes-windows-webui) または他の場所から、Windows用のwhlファイルをインストールしてください。

```powershell
python -m pip install bitsandbytes==0.41.1 --prefer-binary --extra-index-url=https://jllllll.github.io/bitsandbytes-windows-webui
```

## アップグレード

新しいリリースがあった場合、以下のコマンドで更新できます。
Expand Down Expand Up @@ -151,4 +111,47 @@ Conv2d 3x3への拡大は [cloneofsimo氏](https://github.com/cloneofsimo/lora)

[BLIP](https://github.com/salesforce/BLIP): BSD-3-Clause

## その他の情報

### LoRAの名称について

`train_network.py` がサポートするLoRAについて、混乱を避けるため名前を付けました。ドキュメントは更新済みです。以下は当リポジトリ内の独自の名称です。

1. __LoRA-LierLa__ : (LoRA for __Li__ n __e__ a __r__ __La__ yers、リエラと読みます)

Linear 層およびカーネルサイズ 1x1 の Conv2d 層に適用されるLoRA

2. __LoRA-C3Lier__ : (LoRA for __C__ olutional layers with __3__ x3 Kernel and __Li__ n __e__ a __r__ layers、セリアと読みます)

1.に加え、カーネルサイズ 3x3 の Conv2d 層に適用されるLoRA

デフォルトではLoRA-LierLaが使われます。LoRA-C3Lierを使う場合は `--network_args` に `conv_dim` を指定してください。

<!--
LoRA-LierLa は[Web UI向け拡張](https://github.com/kohya-ss/sd-webui-additional-networks)、またはAUTOMATIC1111氏のWeb UIのLoRA機能で使用することができます。

LoRA-C3Lierを使いWeb UIで生成するには拡張を使用してください。
-->

### 学習中のサンプル画像生成

プロンプトファイルは例えば以下のようになります。

```
# prompt 1
masterpiece, best quality, (1girl), in white shirts, upper body, looking at viewer, simple background --n low quality, worst quality, bad anatomy,bad composition, poor, low effort --w 768 --h 768 --d 1 --l 7.5 --s 28

# prompt 2
masterpiece, best quality, 1boy, in business suit, standing at street, looking back --n (low quality, worst quality), bad anatomy,bad composition, poor, low effort --w 576 --h 832 --d 2 --l 5.5 --s 40
```

`#` で始まる行はコメントになります。`--n` のように「ハイフン二個+英小文字」の形でオプションを指定できます。以下が使用可能できます。

* `--n` Negative prompt up to the next option.
* `--w` Specifies the width of the generated image.
* `--h` Specifies the height of the generated image.
* `--d` Specifies the seed of the generated image.
* `--l` Specifies the CFG scale of the generated image.
* `--s` Specifies the number of steps in the generation.

`( )` や `[ ]` などの重みづけも動作します。
Loading