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

[Bug]: Lora cannot be loaded in API mode #7984

Closed
1 task done
GGBond8488 opened this issue Feb 21, 2023 · 24 comments
Closed
1 task done

[Bug]: Lora cannot be loaded in API mode #7984

GGBond8488 opened this issue Feb 21, 2023 · 24 comments
Labels
bug Report of a confirmed bug

Comments

@GGBond8488
Copy link

GGBond8488 commented Feb 21, 2023

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

when I run webui --api to start a simple api only server, and I post a http request ,it show

Skipping unknown extra network: lora
100%|████████████████████████████████████████████████████████████████████████████████████████████| 40/40 [00:11<00:00, 3.39it/s]
INFO: 127.0.0.1:38420 - "POST /sdapi/v1/txt2img HTTP/1.1" 200 OK
INFO: 127.0.0.1:38647 - "POST /sdapi/v1/png-info HTTP/1.1" 200 OK

And I check the web.py, It seems that lora is not registered,for some reason I can't access the web page, so I don't konw if lora works

Steps to reproduce the problem

  1. download release package
  2. download diffusion and lora checkpoint file
  3. run webui.sh to prepare env
  4. exec ./webui.sh --nowebapi
  5. and it occurs

What should have happened?

Skipping unknown extra network: lora shouldn't happen

Commit where the problem happens

release v1.0.0-pre

What platforms do you use to access the UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

./webui.sh --nowebui

List of extensions

No

Console logs

Skipping unknown extra network: lora
100%|████████████████████████████████████████████████████████████████████████████████████████████| 40/40 [00:10<00:00,  3.68it/s]
INFO:     127.0.0.1:39473 - "POST /sdapi/v1/txt2img HTTP/1.1" 200 OK
INFO:     127.0.0.1:39758 - "POST /sdapi/v1/png-info HTTP/1.1" 200 OK

Additional information

No response

@GGBond8488 GGBond8488 added the bug-report Report of a bug, yet to be confirmed label Feb 21, 2023
@fbarretto
Copy link

Do you mind sharing your POST payload?

@alkaideemo
Copy link

Do you mind sharing your POST payload?

I got the same warning, lora model was ignored.

{
	"prompt": "best quality, ultra high res, (photorealistic:1.4), 1girl, brown blazer, black skirt, glasses, thighhighs, ((T shirt)), (upper body), (Kpop idol), (aegyo sal:1), (platinum   blonde hair:1), ((puffy eyes)), looking at viewer, facing front, smiling, <lora:koreanDollLikeness_v10:0.66>",
	"negative_prompt": "nsfw, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, age spot, glan",
	"steps": 28,
	"cfg_scale": 8,
	"width": 768,
	"height": 1024,
	"n_iter": 4,
	"sampler_index": "DPM++ SDE Karras"
}
@GGBond8488
Copy link
Author

GGBond8488 commented Feb 24, 2023

this is my payload, and I can load the lora with webui

payload = {
    "prompt": "<lora:koreanDollLikeness_v10:1>, (8k, RAW photo, best quality, masterpiece:1.2),(realistic, photo-realistic:1.37),omertosa,1lady, (aegyo sal:1),city,professional lighting,photon mapping, radiosity, physically-based rendering,  blue backlight bokeh, smile, mature,head portrait,sunlight,blone,short jacket,school uniform, hoodie, short hair, floating hair",
    "Negative prompt": "EasyNegative, paintings, sketches, EasyNegative, paintings, sketches,  lowres, normal quality, ((monochrome)), ((grayscale)),skin spots, acnes, skin blemishes, age spot,glans,extra fingers,fewer fingers,strange fingers, bad hand, high heel shoes, fat ass,hole,kid,teen,cute,naked, Ripped jeans,hole jeans, fat thigh,6 fingers, bikini,underwear, nsfw, nude, briefs,knickers, underpants,panties, swim suit,leg open",
    "steps": 40,
    "Sampler": "DPM++ 2M Karras",
    "CFG scale": "7",
    "Seed": 3534095324,
    "Model": "chilloutmix_NiPrunedFp32",
    "height":"768",
    "width":"512",
    "Denoising strength": 1,
    "Hires upscale":1,
    "Hires steps":40,
    "Hires upscaler":"Latent"
}
@Chopin68
Copy link

Chopin68 commented Feb 24, 2023

this is my payload, and I can load the lora with webui

payload = {
    "prompt": "<lora:koreanDollLikeness_v10:1>, (8k, RAW photo, best quality, masterpiece:1.2),(realistic, photo-realistic:1.37),omertosa,1lady, (aegyo sal:1),city,professional lighting,photon mapping, radiosity, physically-based rendering,  blue backlight bokeh, smile, mature,head portrait,sunlight,blone,short jacket,school uniform, hoodie, short hair, floating hair",
    "Negative prompt": "EasyNegative, paintings, sketches, EasyNegative, paintings, sketches,  lowres, normal quality, ((monochrome)), ((grayscale)),skin spots, acnes, skin blemishes, age spot,glans,extra fingers,fewer fingers,strange fingers, bad hand, high heel shoes, fat ass,hole,kid,teen,cute,naked, Ripped jeans,hole jeans, fat thigh,6 fingers, bikini,underwear, nsfw, nude, briefs,knickers, underpants,panties, swim suit,leg open",
    "steps": 40,
    "Sampler": "DPM++ 2M Karras",
    "CFG scale": "7",
    "Seed": 3534095324,
    "Model": "chilloutmix_NiPrunedFp32",
    "height":"768",
    "width":"512",
    "Denoising strength": 1,
    "Hires upscale":1,
    "Hires steps":40,
    "Hires upscaler":"Latent"
}

Is your Superresolution valid? I don't seem to increase the image resolution, even though "Hires upscale": 2. By the way, have you tried the hires.fox of img2img?

@amliuxin
Copy link

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch.
And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

@sleep2death
Copy link

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch. And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

Yes, it's a bug with the "API"

@GGBond8488
Copy link
Author

GGBond8488 commented Mar 1, 2023

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch. And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

after adding this, it works, thank you very much

@PromptExpert
Copy link

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch. And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

works for me, well done! Thanks!

@tenghui98
Copy link

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch. And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

Thank you bro. it works

@954L
Copy link

954L commented Apr 8, 2023

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch. And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

Thank you bro. it works

@tenpha I changed it so that I won't go wrong, but it still doesn't work. What about you?

@Noobmaster6978
Copy link

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch. And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

Im a noob in coding, can you explain where is this "def api_only()"

@2424004764
Copy link

extra_network = extra_network_registry.get(extra_network_name, None)

我发现这个变量extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>},lora 在 api 启动后没有注册。 并且 lora 在这一行中作为扩展加载:

modules.script_callbacks.before_ui_callback()

我复制modules.script_callbacks.before_ui_callback()到 def api_only(),效果很好

it works

@Noobmaster6978
Copy link

extra_network = extra_network_registry.get(extra_network_name, None)

我发现这个变量extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>},lora 在 api 启动后没有注册。 并且 lora 在这一行中作为扩展加载:

modules.script_callbacks.before_ui_callback()

我复制modules.script_callbacks.before_ui_callback()到 def api_only(),效果很好

it works

Thank you for your time. But I'm on Collab so can't edit directly, So I downloaded the "webui.py" and edited it locally then reuploaded it in its folder in place of the old file in google drive. But after running SD when I checked, the file was back to the original one and my issue didn't got resolved. It's still showing the error: "Skipping unknown extra network: [loraname_version]". What am I doing wrong?

@Noobmaster6978
Copy link

Tried this solution to fix the bug for the past few days. Its not working for me

1 similar comment
@Noobmaster6978
Copy link

Tried this solution to fix the bug for the past few days. Its not working for me

@SunSoul
Copy link

SunSoul commented Apr 27, 2023

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch. And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

Thank you. it works

@Insadem
Copy link

Insadem commented May 5, 2023

extra_network = extra_network_registry.get(extra_network_name, None)

I found this variable extra_network_registry={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>}, lora is not registried after api launch. And lora was loaded as extension in this line:

modules.script_callbacks.before_ui_callback()

I copyed modules.script_callbacks.before_ui_callback() into def api_only(), and works well

Yes, this works very well! Thank you

@ktncktnc
Copy link

ktncktnc commented May 8, 2023

Tried this solution to fix the bug for the past few days. Its not working for me

Edit the webui.py file first, and then you need to restart the process

@Javinciii
Copy link

It doesn't work in the latest version

@ibrainventures
Copy link
Contributor

updated today our stack ( [5ab7f21] - latest release 2nd of May 23) and this "patch" is still working fine.

for workflow / Docker we are using this little sed patch.
RUN sed -i -e '/ api = create_api/a\' -e ' modules.script_callbacks.before_ui_callback()' webui.py

@zhangyic0
Copy link

The fix worked for me

@conanak99
Copy link

Why is this still a bug and not fixed in the API >.<?

huaizong pushed a commit to huaizong/stable-diffusion-webui that referenced this issue Aug 7, 2023
@catboxanon catboxanon added bug Report of a confirmed bug and removed bug-report Report of a bug, yet to be confirmed labels Aug 7, 2023
@catboxanon
Copy link
Collaborator

Merged in dev. #12387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report of a confirmed bug