AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Skipping unknown extra network: lora #9274

Closed ykallan closed 1 year ago

ykallan commented 1 year ago

Is there an existing issue for this?

What happened?

i start api server by command: webui.bat --nowebui --enable-insecure-extension-access but got

Skipping unknown extra network: lora

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

INFO:     Started server process [17088]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:7861 (Press CTRL+C to quit)
Skipping unknown extra network: lora
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.35it/s]
INFO:     127.0.0.1:60194 - "POST /sdapi/v1/txt2img HTTP/1.1" 200 OK███████████████████| 20/20 [00:03<00:00,  7.28it/s]
INFO:     127.0.0.1:60199 - "POST /sdapi/v1/png-info HTTP/1.1" 200 OK

cannot load the lora

Commit where the problem happens

webui.bat --nowebui --enable-insecure-extension-access

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

import io
import requests
import base64
from PIL import Image, PngImagePlugin

url = "http://localhost:7861"

prompt = """
<lora:chineseGirl_v10:0.1><lora:cuteGirlMix4_v10:0.2><lora:chineseQingchunGirl_chineseQingchunGirl:0.2><lora:dreamyGirlsFace_dreamyFace:0.5>, (8k, RAW photo, best quality, masterpiece:1.3),(realistic, photo-realistic:1.37),posing,sea beach,nightcityscape,night, cyberpunk city,soft light,1girl,extremely beautiful face,bust,(put down hands), Random hairstyle,white hair,Random expression,small eyes, ,lower abdomen
"""

negative_prompt = """
nsfw, NSFW, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, strange fingers
"""

data = {"prompt": prompt.strip(),
        "n_iter": 1,
        "steps": 20,
        "cfg_scale": 7,
        "negative_prompt": negative_prompt.strip(),
        "Sampler": "DPM++ 2M Karras",
        "width": 512,
        "height": 768,
        "Model": "chilloutmix_NiPrunedFp32Fix.safetensors [fc2511737a]",
        "send_images": True,
        "save_images": True,
        "seed": -1,
        "subseed": -1,
        "subseed_strength": 0,

        }

response = requests.post(url=f"{url}/sdapi/v1/txt2img", json=data)

with open("./resp.png", "wb") as f:
    f.write(response.content)

print(response.headers)
print(response.status_code)

# print(response.text)
resp = response.json()
for idx, i in enumerate(resp['images']):
    image = Image.open(io.BytesIO(base64.b64decode(i.split(",", 1)[0])))
    png_payload = {
        "image": "data:image/png;base64," + i
    }
    response2 = requests.post(url=f'{url}/sdapi/v1/png-info', json=png_payload)
    pnginfo = PngImagePlugin.PngInfo()
    pnginfo.add_text("parameters", response2.json().get("info"))
    image.save(f'output_{idx}.png', pnginfo=pnginfo)

List of extensions

Skipping unknown extra network: lora

Console logs

INFO:     Started server process [17088]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:7861 (Press CTRL+C to quit)
Skipping unknown extra network: lora
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.35it/s]
INFO:     127.0.0.1:60194 - "POST /sdapi/v1/txt2img HTTP/1.1" 200 OK███████████████████| 20/20 [00:03<00:00,  7.28it/s]
INFO:     127.0.0.1:60199 - "POST /sdapi/v1/png-info HTTP/1.1" 200 OK
Skipping unknown extra network: lora
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:03<00:00,  5.13it/s]
INFO:     127.0.0.1:60316 - "POST /sdapi/v1/txt2img HTTP/1.1" 200 OK
INFO:     127.0.0.1:60319 - "POST /sdapi/v1/png-info HTTP/1.1" 200 OK

Additional information

i got the img, but i cannot use the lora extentions,

then i add command

def api_only():
    initialize()

    app = FastAPI()
    setup_middleware(app)
    api = create_api(app)

    modules.script_callbacks.app_started_callback(None, app)  # this is i add

    print(f"Startup time: {startup_timer.summary()}.")
    api.launch(server_name="0.0.0.0" if cmd_opts.listen else "127.0.0.1", port=cmd_opts.port if cmd_opts.port else 7861)

but its does not work at all.

Roshag commented 1 year ago

Built-in extension does not work atm with different errors. The original one by kohya-ss works, but it is much less convenient to use.

ykallan commented 1 year ago

Built-in extension does not work atm with different errors. The original one by kohya-ss works, but it is much less convenient to use.

want to know how can i use lora model by api

nicosezam commented 1 year ago

I also need the API works with Lora models

PandaXu313 commented 1 year ago

I used the solution in the 7984 and it works

catboxanon commented 1 year ago

Duplicate of https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7984 -- resolved by https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12387