kohya-ss / kohya-ss/sd-scripts

The lora+ setting and prodigy cannot be used together.

Open
#1,929 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

LoRA+ UNet LR Ratio: 4.0
LoRA+ Text Encoder LR Ratio: 4.0
enable LoRA for text encoder: 88 modules
enable LoRA for U-Net: 722 modules
prepare optimizer, data loader etc.
when multiple learning rates are specified with dadaptation (e.g. for Text Encoder and U-Net), only the first one will take effect / D-AdaptationまたはProdigyで複数の学習率を指定した場合(Text EncoderとU-Netなど)、最初の学習率のみが有効になります: lr=1
use Prodigy optimizer | {'d_coef': 1, 'safeguard_warmup': True, 'decouple': True, 'weight_decay': 0.01, 'betas': (0.9, 0.99), 'use_bias_correction': True}
Using decoupled weight decay
override steps. steps for 15 epochs is / 指定エポックまでのステップ数: 1920
running training / 学習開始
num train images * repeats / 学習画像の数×繰り返し回数: 128
num validation images * repeats / 学習画像の数×繰り返し回数: 0
num reg images / 正則化画像の数: 0
num batches per epoch / 1epochのバッチ数: 128
num epochs / epoch数: 15
batch size per device / バッチサイズ: 1
gradient accumulation steps / 勾配を合計するステップ数 = 1
total optimization steps / 学習ステップ数: 1920
steps: 0% 0/1920 [00:00
trainer.train(args)
File "/content/trainer/sd_scripts/train_network.py", line 1325, in train
optimizer.step()
File "/content/trainer/sd_scripts/venv/lib/python3.10/site-packages/accelerate/optimizer.py", line 157, in step
self.scaler.step(self.optimizer, closure)
File "/content/trainer/sd_scripts/venv/lib/python3.10/site-packages/torch/amp/grad_scaler.py", line 457, in step
retval = self._maybe_opt_step(optimizer, optimizer_state, *args, **kwargs)
File "/content/trainer/sd_scripts/venv/lib/python3.10/site-packages/torch/amp/grad_scaler.py", line 352, in _maybe_opt_step
retval = optimizer.step(*args, **kwargs)
File "/content/trainer/sd_scripts/venv/lib/python3.10/site-packages/accelerate/optimizer.py", line 212, in patched_step
return method(*args, **kwargs)
File "/content/trainer/sd_scripts/venv/lib/python3.10/site-packages/torch/optim/lr_scheduler.py", line 137, in wrapper
return func.__get__(opt, opt.__class__)(*args, **kwargs)
File "/content/trainer/sd_scripts/venv/lib/python3.10/site-packages/torch/optim/optimizer.py", line 487, in wrapper
out = func(*args, **kwargs)
File "/content/trainer/sd_scripts/venv/lib/python3.10/site-packages/prodigyopt/prodigy.py", line 146, in step
raise RuntimeError(f"Setting different lr values in different parameter groups is only supported for values of 0")
RuntimeError: Setting different lr values in different parameter groups is only supported for values of 0
steps: 0% 0/1920 [00:07

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with sdxl_train_network.py and train_network.py at the training and optimizer.step() paths shown in the traceback. Reproduce with LoRA+ enabled for the U-Net and text encoder and the Prodigy optimizer, then trace how their learning rates become parameter groups; done means the reported RuntimeError no longer occurs for this configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.