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

The lora+ setting and prodigy cannot be used together. #1929

Open
ytoaa opened this issue Feb 12, 2025 · 1 comment
Open

The lora+ setting and prodigy cannot be used together. #1929

ytoaa opened this issue Feb 12, 2025 · 1 comment

Comments

@ytoaa
Copy link

ytoaa commented Feb 12, 2025

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<?, ?it/s]unet dtype: torch.float16, device: cuda:0
text_encoder [0] dtype: torch.float16, device: cuda:0
text_encoder [1] dtype: torch.float16, device: cuda:0

epoch 1/15

epoch is incremented. current_epoch: 0, epoch: 1
Traceback (most recent call last):
File "/content/trainer/sd_scripts/sdxl_train_network.py", line 230, in
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<?, ?it/s]

An error occurs when setting "loraplus_lr_ratio=4" as follows. I know this error occurs when unet and text learning rates are different
It's strange.

@rockerBOO
Copy link
Contributor

Prodigy doesn't support parameter groups so it won't work with that optimizer, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants