stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: Lora cannot be loaded in API mode
Is there an existing issue for this?
- [X] 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
- download release package
- download diffusion and lora checkpoint file
- run webui.sh to prepare env
- exec ./webui.sh --nowebapi
- 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
Do you mind sharing your POST payload?
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"
}
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"
}
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?
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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:
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
I copyed modules.script_callbacks.before_ui_callback()
into def api_only(), and works well
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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:https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
I copyed
modules.script_callbacks.before_ui_callback()
into def api_only(), and works well
Yes, it's a bug with the "API"
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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:https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
I copyed
modules.script_callbacks.before_ui_callback()
into def api_only(), and works well
after adding this, it works, thank you very much
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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:https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
I copyed
modules.script_callbacks.before_ui_callback()
into def api_only(), and works well
works for me, well done! Thanks!
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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:https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
I copyed
modules.script_callbacks.before_ui_callback()
into def api_only(), and works well
Thank you bro. it works
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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: https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203I copyed
modules.script_callbacks.before_ui_callback()
into def api_only(), and works wellThank you bro. it works
@tenpha I changed it so that I won't go wrong, but it still doesn't work. What about you?
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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:https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
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()"
@Noobmaster6978
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
我发现这个变量
extra_network_registry
={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>},lora 在 api 启动后没有注册。 并且 lora 在这一行中作为扩展加载:https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
我复制
modules.script_callbacks.before_ui_callback()
到 def api_only(),效果很好
it works
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
我发现这个变量
extra_network_registry
={'hypernet': <modules.extra_networks_hypernet.ExtraNetworkHypernet object at 0x000002181B293F70>},lora 在 api 启动后没有注册。 并且 lora 在这一行中作为扩展加载: https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203我复制
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?
Tried this solution to fix the bug for the past few days. Its not working for me
Tried this solution to fix the bug for the past few days. Its not working for me
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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:https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
I copyed
modules.script_callbacks.before_ui_callback()
into def api_only(), and works well
Thank you. it works
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extra_networks.py#L69
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:https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/webui.py#L203
I copyed
modules.script_callbacks.before_ui_callback()
into def api_only(), and works well
Yes, this works very well! Thank you
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
It doesn't work in the latest version
updated today our stack ( [5ab7f213] - 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
The fix worked for me
Why is this still a bug and not fixed in the API >.<?
Merged in dev. https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12387