bmaltais / kohya_ss

Apache License 2.0
9.54k stars 1.23k forks source link

[Error] extracing Lycoris from custom ckpt #1842

Closed elsucht closed 9 months ago

elsucht commented 9 months ago

Using your code regulary to extract Loras/Lycoris from trained dreambooth checkpoints (using fast-dreambooth). Now I'm getting an error (also using --device gpu):

13:00:25-409297 INFO     ./venv/Scripts/python.exe "tools\lycoris_locon_extract.py" --device cpu --mode fixed --safetensors --linear_dim 64   
                         --conv_dim 32 --sparsity 0.98 "D:/sd/stable-diffusion-webui/models/Stable-diffusion/cyberrealistic_v33.safetensors"  
                         "D:/sd/stable-diffusion-webui/models/Stable-diffusion/self_trained/test.ckpt"
                         "D:/sd/stable-diffusion-webui/models/Stable-diffusion/self_trained/locon_test.safetensors"
UNet2DConditionModel: 64, 8, 768, False, False
loading u-net: <All keys matched successfully>
loading vae: <All keys matched successfully>
loading text encoder: <All keys matched successfully>
UNet2DConditionModel: 64, 8, 768, False, False
loading u-net: <All keys matched successfully>
loading vae: <All keys matched successfully>
loading text encoder: <All keys matched successfully>
Traceback (most recent call last):
  File "D:\sd\kohya_ss\tools\lycoris_locon_extract.py", line 190, in <module>
    main()
  File "D:\sd\kohya_ss\tools\lycoris_locon_extract.py", line 169, in main
    state_dict = extract_diff(
  File "D:\sd\kohya_ss\venv\lib\site-packages\lycoris\utils\__init__.py", line 376, in extract_diff
    for idx, te1, te2 in enumerate(zip(base_tes, db_tes)):
ValueError: not enough values to unpack (expected 3, got 2)
13:00:40-339559 INFO     Done extracting...

Any idea what could be the reason for this?

elsucht commented 9 months ago

looks like it is a small bug in the lycoris package. Create a pull request.