Skip to content

Commit 4d993fa

Browse files
authored
Merge branch 'dev_improve_log' into use_logger
2 parents 3981ba4 + 7f948db commit 4d993fa

29 files changed

+952
-681
lines changed

README.md

+82-2
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,86 @@ ControlNet-LLLite, a novel method for ControlNet with SDXL, is added. See [docum
249249

250250
## Change History
251251

252+
### Jan 27, 2024 / 2024/1/27: v0.8.3
253+
254+
- Fixed a bug that the training crashes when `--fp8_base` is specified with `--save_state`. PR [#1079](https://github.com/kohya-ss/sd-scripts/pull/1079) Thanks to feffy380!
255+
- `safetensors` is updated. Please see [Upgrade](#upgrade) and update the library.
256+
- Fixed a bug that the training crashes when `network_multiplier` is specified with multi-GPU training. PR [#1084](https://github.com/kohya-ss/sd-scripts/pull/1084) Thanks to fireicewolf!
257+
- Fixed a bug that the training crashes when training ControlNet-LLLite.
258+
259+
- `--fp8_base` 指定時に `--save_state` での保存がエラーになる不具合が修正されました。 PR [#1079](https://github.com/kohya-ss/sd-scripts/pull/1079) feffy380 氏に感謝します。
260+
- `safetensors` がバージョンアップされていますので、[Upgrade](#upgrade) を参照し更新をお願いします。
261+
- 複数 GPU での学習時に `network_multiplier` を指定するとクラッシュする不具合が修正されました。 PR [#1084](https://github.com/kohya-ss/sd-scripts/pull/1084) fireicewolf 氏に感謝します。
262+
- ControlNet-LLLite の学習がエラーになる不具合を修正しました。
263+
264+
### Jan 23, 2024 / 2024/1/23: v0.8.2
265+
266+
- [Experimental] The `--fp8_base` option is added to the training scripts for LoRA etc. The base model (U-Net, and Text Encoder when training modules for Text Encoder) can be trained with fp8. PR [#1057](https://github.com/kohya-ss/sd-scripts/pull/1057) Thanks to KohakuBlueleaf!
267+
- Please specify `--fp8_base` in `train_network.py` or `sdxl_train_network.py`.
268+
- PyTorch 2.1 or later is required.
269+
- If you use xformers with PyTorch 2.1, please see [xformers repository](https://github.com/facebookresearch/xformers) and install the appropriate version according to your CUDA version.
270+
- The sample image generation during training consumes a lot of memory. It is recommended to turn it off.
271+
272+
- [Experimental] The network multiplier can be specified for each dataset in the training scripts for LoRA etc.
273+
- This is an experimental option and may be removed or changed in the future.
274+
- For example, if you train with state A as `1.0` and state B as `-1.0`, you may be able to generate by switching between state A and B depending on the LoRA application rate.
275+
- Also, if you prepare five states and train them as `0.2`, `0.4`, `0.6`, `0.8`, and `1.0`, you may be able to generate by switching the states smoothly depending on the application rate.
276+
- Please specify `network_multiplier` in `[[datasets]]` in `.toml` file.
277+
- Some options are added to `networks/extract_lora_from_models.py` to reduce the memory usage.
278+
- `--load_precision` option can be used to specify the precision when loading the model. If the model is saved in fp16, you can reduce the memory usage by specifying `--load_precision fp16` without losing precision.
279+
- `--load_original_model_to` option can be used to specify the device to load the original model. `--load_tuned_model_to` option can be used to specify the device to load the derived model. The default is `cpu` for both options, but you can specify `cuda` etc. You can reduce the memory usage by loading one of them to GPU. This option is available only for SDXL.
280+
281+
- The gradient synchronization in LoRA training with multi-GPU is improved. PR [#1064](https://github.com/kohya-ss/sd-scripts/pull/1064) Thanks to KohakuBlueleaf!
282+
- The code for Intel IPEX support is improved. PR [#1060](https://github.com/kohya-ss/sd-scripts/pull/1060) Thanks to akx!
283+
- Fixed a bug in multi-GPU Textual Inversion training.
284+
285+
- (実験的) LoRA等の学習スクリプトで、ベースモデル(U-Net、および Text Encoder のモジュール学習時は Text Encoder も)の重みを fp8 にして学習するオプションが追加されました。 PR [#1057](https://github.com/kohya-ss/sd-scripts/pull/1057) KohakuBlueleaf 氏に感謝します。
286+
- `train_network.py` または `sdxl_train_network.py``--fp8_base` を指定してください。
287+
- PyTorch 2.1 以降が必要です。
288+
- PyTorch 2.1 で xformers を使用する場合は、[xformers のリポジトリ](https://github.com/facebookresearch/xformers) を参照し、CUDA バージョンに応じて適切なバージョンをインストールしてください。
289+
- 学習中のサンプル画像生成はメモリを大量に消費するため、オフにすることをお勧めします。
290+
- (実験的) LoRA 等の学習で、データセットごとに異なるネットワーク適用率を指定できるようになりました。
291+
- 実験的オプションのため、将来的に削除または仕様変更される可能性があります。
292+
- たとえば状態 A を `1.0`、状態 B を `-1.0` として学習すると、LoRA の適用率に応じて状態 A と B を切り替えつつ生成できるかもしれません。
293+
- また、五段階の状態を用意し、それぞれ `0.2``0.4``0.6``0.8``1.0` として学習すると、適用率でなめらかに状態を切り替えて生成できるかもしれません。
294+
- `.toml` ファイルで `[[datasets]]``network_multiplier` を指定してください。
295+
- `networks/extract_lora_from_models.py` に使用メモリ量を削減するいくつかのオプションを追加しました。
296+
- `--load_precision` で読み込み時の精度を指定できます。モデルが fp16 で保存されている場合は `--load_precision fp16` を指定して精度を変えずにメモリ量を削減できます。
297+
- `--load_original_model_to` で元モデルを読み込むデバイスを、`--load_tuned_model_to` で派生モデルを読み込むデバイスを指定できます。デフォルトは両方とも `cpu` ですがそれぞれ `cuda` 等を指定できます。片方を GPU に読み込むことでメモリ量を削減できます。SDXL の場合のみ有効です。
298+
- マルチ GPU での LoRA 等の学習時に勾配の同期が改善されました。 PR [#1064](https://github.com/kohya-ss/sd-scripts/pull/1064) KohakuBlueleaf 氏に感謝します。
299+
- Intel IPEX サポートのコードが改善されました。PR [#1060](https://github.com/kohya-ss/sd-scripts/pull/1060) akx 氏に感謝します。
300+
- マルチ GPU での Textual Inversion 学習の不具合を修正しました。
301+
302+
- `.toml` example for network multiplier / ネットワーク適用率の `.toml` の記述例
303+
304+
```toml
305+
[general]
306+
[[datasets]]
307+
resolution = 512
308+
batch_size = 8
309+
network_multiplier = 1.0
310+
311+
... subset settings ...
312+
313+
[[datasets]]
314+
resolution = 512
315+
batch_size = 8
316+
network_multiplier = -1.0
317+
318+
... subset settings ...
319+
```
320+
321+
322+
### Jan 17, 2024 / 2024/1/17: v0.8.1
323+
324+
- Fixed a bug that the VRAM usage without Text Encoder training is larger than before in training scripts for LoRA etc (`train_network.py`, `sdxl_train_network.py`).
325+
- Text Encoders were not moved to CPU.
326+
- Fixed typos. Thanks to akx! [PR #1053](https://github.com/kohya-ss/sd-scripts/pull/1053)
327+
328+
- LoRA 等の学習スクリプト(`train_network.py``sdxl_train_network.py`)で、Text Encoder を学習しない場合の VRAM 使用量が以前に比べて大きくなっていた不具合を修正しました。
329+
- Text Encoder が GPU に保持されたままになっていました。
330+
- 誤字が修正されました。 [PR #1053](https://github.com/kohya-ss/sd-scripts/pull/1053) akx 氏に感謝します。
331+
252332
### Jan 15, 2024 / 2024/1/15: v0.8.0
253333

254334
- Diffusers, Accelerate, Transformers and other related libraries have been updated. Please update the libraries with [Upgrade](#upgrade).
@@ -257,7 +337,7 @@ ControlNet-LLLite, a novel method for ControlNet with SDXL, is added. See [docum
257337
- This feature works only on Linux or WSL.
258338
- Please specify `--torch_compile` option in each training script.
259339
- You can select the backend with `--dynamo_backend` option. The default is `"inductor"`. `inductor` or `eager` seems to work.
260-
- Please use `--spda` option instead of `--xformers` option.
340+
- Please use `--sdpa` option instead of `--xformers` option.
261341
- PyTorch 2.1 or later is recommended.
262342
- Please see [PR](https://github.com/kohya-ss/sd-scripts/pull/1024) for details.
263343
- The session name for wandb can be specified with `--wandb_run_name` option. PR [#1032](https://github.com/kohya-ss/sd-scripts/pull/1032) Thanks to hopl1t!
@@ -270,7 +350,7 @@ ControlNet-LLLite, a novel method for ControlNet with SDXL, is added. See [docum
270350
- Linux または WSL でのみ動作します。
271351
- 各学習スクリプトで `--torch_compile` オプションを指定してください。
272352
- `--dynamo_backend` オプションで使用される backend を選択できます。デフォルトは `"inductor"` です。 `inductor` または `eager` が動作するようです。
273-
- `--xformers` オプションとは互換性がありません。 代わりに `--spda` オプションを使用してください。
353+
- `--xformers` オプションとは互換性がありません。 代わりに `--sdpa` オプションを使用してください。
274354
- PyTorch 2.1以降を推奨します。
275355
- 詳細は [PR](https://github.com/kohya-ss/sd-scripts/pull/1024) をご覧ください。
276356
- wandb 保存時のセッション名が各学習スクリプトの `--wandb_run_name` オプションで指定できるようになりました。 PR [#1032](https://github.com/kohya-ss/sd-scripts/pull/1032) hopl1t 氏に感謝します。

XTI_hijack.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import torch
2-
try:
3-
import intel_extension_for_pytorch as ipex
4-
if torch.xpu.is_available():
5-
from library.ipex import ipex_init
6-
ipex_init()
7-
except Exception:
8-
pass
2+
from library.ipex_interop import init_ipex
3+
4+
init_ipex()
95
from typing import Union, List, Optional, Dict, Any, Tuple
106
from diffusers.models.unet_2d_condition import UNet2DConditionOutput
117

fine_tune.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,10 @@
1111
from tqdm import tqdm
1212
import torch
1313

14-
try:
15-
import intel_extension_for_pytorch as ipex
14+
from library.ipex_interop import init_ipex
1615

17-
if torch.xpu.is_available():
18-
from library.ipex import ipex_init
16+
init_ipex()
1917

20-
ipex_init()
21-
except Exception:
22-
pass
2318
from accelerate.utils import set_seed
2419
from diffusers import DDPMScheduler
2520

gen_img_diffusers.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,10 @@
6666
import numpy as np
6767
import torch
6868

69-
try:
70-
import intel_extension_for_pytorch as ipex
69+
from library.ipex_interop import init_ipex
7170

72-
if torch.xpu.is_available():
73-
from library.ipex import ipex_init
71+
init_ipex()
7472

75-
ipex_init()
76-
except Exception:
77-
pass
7873
import torchvision
7974
from diffusers import (
8075
AutoencoderKL,

0 commit comments

Comments
 (0)