bmaltais / kohya_ss

Apache License 2.0
9.54k stars 1.23k forks source link

Trained LoRA not functioning (not enough values to unpack (expected 2, got 1)) #670

Closed alternateaccount11111 closed 8 months ago

alternateaccount11111 commented 1 year ago

After training a LoRA using Automatic1111's interface on a specific art style, I can't manage to get the LoRA to actually function. When I run a prompt with the LoRA, image

I don't see any other mentions of the issue except for one or two threads on reddit of which did not provide helpful responses. The only thing I can see being wrong was I downloaded the new version of torch (2.0), but then proceeded to uninstall and revert back to the one that supposedly works (1.12.1)

If anyone has experienced this issue and/or knows a fix or knows what I did wrong, that would be greatly appreciated.

alternateaccount11111 commented 1 year ago

I actually finally found a (useful) post related to the issue https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9542/commits/610891f7295bb70476dc0b644d5a640ca95002dc

Despite implementing the fix, while it no longer complains that there is an issue, it either does not have any impact or changes the image ever so slightly with super high weighting (but it does not change between say 2.7 and 8.0, it just changes the first time and no longer works)

I've tried multiple models and it doesn't seem to work with any of them, including the one it was created with (the default v1-5-pruned-emaonly.safetensors). If I need to recreate the original training parameters, I can, but they were very similar to Aitrepreneur's defaults for low VRAM with some slight tweaks to adjust for the training image sizes being (400x600).

marshalleq commented 9 months ago

Because I haven't found it anywhere else, I thought I'd just add an 'I'm getting this too' but actually while attempting to train. I cut off at the training command below. The system keeps running but just gets this error and nothing happens.

create LoRA for Text Encoder 1:
create LoRA for Text Encoder 2:
create LoRA for Text Encoder: 264 modules.
create LoRA for U-Net: 722 modules.
enable LoRA for text encoder
enable LoRA for U-Net
prepare optimizer, data loader etc.
use Adafactor optimizer | {'relative_step': True}
relative_step is true / relative_stepがtrueですlearning rate is used as initial_lr / 指定したlearning rateはinitial_lrとして使用されますunet_lr and text_encoder_lr are ignored / unet_lrとtext_encoder_lrは無視されますoverride steps. steps for 30 epochs is / 指定エポックまでのステップ数: 147840
Traceback (most recent call last):
  File "/mnt/ssd2tb_crucial/projects/kohya_ss/./sdxl_train_network.py", line 185, in <module>
    trainer.train(args)
  File "/mnt/ssd2tb_crucial/projects/kohya_ss/train_network.py", line 370, in train
    lr_scheduler = train_util.get_scheduler_fix(args, optimizer, accelerator.num_processes)
  File "/mnt/ssd2tb_crucial/projects/kohya_ss/library/train_util.py", line 3670, in get_scheduler_fix
    key, value = arg.split("=")
ValueError: not enough values to unpack (expected 2, got 1)
Traceback (most recent call last):
  File "/mnt/ssd2tb_crucial/projects/kohya_ss/venv/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/mnt/ssd2tb_crucial/projects/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 47, in main
    args.func(args)
  File "/mnt/ssd2tb_crucial/projects/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 986, in launch_command
    simple_launcher(args)
  File "/mnt/ssd2tb_crucial/projects/kohya_ss/venv/lib/python3.10/site-packages/accelerate/commands/launch.py", line 628, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/mnt/ssd2tb_crucial/projects/kohya_ss/venv/bin/python', './sdxl_train_network.py',