AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.78k stars 26.49k forks source link

[Bug]: Cannot apply LORA in extra networks function (TypeError: pop expected at most 1 argument, got 2) #7355

Closed henryvii99 closed 1 year ago

henryvii99 commented 1 year ago

Is there an existing issue for this?

What happened?

LORA files generated by SD dreambooth extension (https://github.com/d8ahazard/sd_dreambooth_extension) cannot be applied by extra networks function. However, the resultant LORA can be used in the extension "generate sample images" function, and generate target image perfectly.

Steps to reproduce the problem

  1. Select model anything v4.5, Press show extra network.
  2. Select LORA tab, click refresh
  3. Press my LORA file, a prompt shows in prompts section.
  4. (Prompt:, masterpiece, best quality,1girl)
  5. Image can be generated but only showing generic waifu, removing shows generic anime waifu

What should have happened?

Generic my target waifu as in "generate sample images" function in dreambooth extension.

Commit where the problem happens

cc8c9b7474d917888a0bd069fcd59a458c67ae4b

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--no-half --autolaunch --xformers

List of extensions

https://github.com/d8ahazard/sd_dreambooth_extension https://github.com/yfszzx/stable-diffusion-webui-images-browser https://github.com/KutsuyaYuki/ABG_extension.git

Console logs

activating extra network lora with arguments [<modules.extra_networks.ExtraNetworkParams object at 0x0000018793915F90>]: TypeError
Traceback (most recent call last):
  File "C:\git\stable-diffusion-webui\modules\extra_networks.py", line 75, in activate
    extra_network.activate(p, extra_network_args)
  File "C:\git\stable-diffusion-webui\extensions-builtin\Lora\extra_networks_lora.py", line 17, in activate
    lora.load_loras(names, multipliers)
  File "C:\git\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 151, in load_loras
    lora = load_lora(name, lora_on_disk.filename)
  File "C:\git\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 83, in load_lora
    sd = sd_models.read_state_dict(filename)
  File "C:\git\stable-diffusion-webui\modules\sd_models.py", line 213, in read_state_dict
    sd = get_state_dict_from_checkpoint(pl_sd)
  File "C:\git\stable-diffusion-webui\modules\sd_models.py", line 186, in get_state_dict_from_checkpoint
    pl_sd = pl_sd.pop("state_dict", pl_sd)
TypeError: pop expected at most 1 argument, got 2

Additional information

Since LORA can be applied in the extension and produce target image, but not in webui, I suspect it is something related here, rather than extension malfunction.

kkiqq22 commented 1 year ago

me too,this error not fixed

kkiqq22 commented 1 year ago

hello, The size of the model file trained by some LORA frameworks is 288mb webui is working,bug size 2-6mb LORA webui is not work,why?

Baughn commented 1 year ago

This is a duplicate of #7156