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]: Drop down menu of ´Add Lora to prompt´ does nont have a ´none´ selection and always charge the last Lora selected #9041

Closed
1 task done
mateocarcasi opened this issue Mar 27, 2023 · 11 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@mateocarcasi
Copy link

Is there an existing issue for this?

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

What happened?

The Drop down menu of ´Add Lora to prompt´ does nont have a ´none´ selection and always charge the last Lora selected I created a ´blank´ Lora, and works but show a error in the process,

activating extra network lora: SafetensorError
Traceback (most recent call last):
File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\modules\extra_networks.py", line 85, in activate
extra_network.activate(p, [])
File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\extensions-builtin\Lora\extra_networks_lora.py", line 23, in activate
lora.load_loras(names, multipliers)
File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 214, in load_loras
lora = load_lora(name, lora_on_disk.filename)
File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 133, in load_lora
sd = sd_models.read_state_dict(filename)
File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\modules\sd_models.py", line 241, in read_state_dict
pl_sd = safetensors.torch.load_file(checkpoint_file, device=device)
File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\venv\lib\site-packages\safetensors\torch.py", line 99, in load_file
with safe_open(filename, framework="pt", device=device) as f:
safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooSmall

Steps to reproduce the problem

  1. Go to settings
  2. Enable sd_lora in user interface
  3. reset the ui
  4. select a lora
  5. generate a image
  6. try to erase or deselec the
    Captura de pantalla 2023-03-27 094521
    lora

What should have happened?

Maybe the dropmanu can have a none seltion to leave it blank

Commit where the problem happens

955df77

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

No

List of extensions

Stable-Diffusion-Webui-Civitai-Helper | https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper | 2870a489 (Thu Mar 23 13:46:45 2023) | unknown
a1111-sd-webui-tagcomplete | https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git | 296b945 (Sun Mar 26 23:19:24 2023) | unknown
openpose-editor | https://github.com/fkunn1326/openpose-editor | 79155e82 (Sun Mar 26 23:45:55 2023) | unknown
sd-webui-3d-open-pose-editor | https://github.com/nonnonstop/sd-webui-3d-open-pose-editor.git | 231c4512 (Sat Mar 25 14:15:19 2023) | unknown
sd-webui-ar | https://github.com/alemelis/sd-webui-ar.git | ce0a645c (Thu Feb 23 13:59:23 2023) | unknown
sd-webui-controlnet | https://github.com/Mikubill/sd-webui-controlnet | 241c05f (Thu Mar 23 15:18:35 2023) | unknown
sd-webui-cutoff | https://github.com/hnmr293/sd-webui-cutoff | 89b90487 (Wed Mar 22 15:47:20 2023) | unknown
stable-diffusion-webui-composable-lora | https://github.com/opparco/stable-diffusion-webui-composable-lora.git | d4963e48 (Mon Feb 27 17:40:08 2023) | unknown
stable-diffusion-webui-rembg | https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git | 64821f04 (Sun Mar 12 15:32:00 2023) | unknown
stable-diffusion-webui-two-shot | https://github.com/ashen-sensored/stable-diffusion-webui-two-shot.git | a761ead4 (Wed Mar 15 15:23:33 2023) | unknown
LDSR | built-in |   |  
Lora | built-in |   |  
ScuNET | built-in |   |  
SwinIR | built-in |   |  
prompt-bracket-checker | built-in


Extension URL Version Update Stable-Diffusion-Webui-Civitai-Helper https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper 2870a489 (Thu Mar 23 13:46:45 2023) unknown a1111-sd-webui-tagcomplete https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git 296b945 (Sun Mar 26 23:19:24 2023) unknown openpose-editor https://github.com/fkunn1326/openpose-editor 79155e82 (Sun Mar 26 23:45:55 2023) unknown sd-webui-3d-open-pose-editor https://github.com/nonnonstop/sd-webui-3d-open-pose-editor.git 231c4512 (Sat Mar 25 14:15:19 2023) unknown sd-webui-ar https://github.com/alemelis/sd-webui-ar.git ce0a645c (Thu Feb 23 13:59:23 2023) unknown sd-webui-controlnet https://github.com/Mikubill/sd-webui-controlnet 241c05f (Thu Mar 23 15:18:35 2023) unknown sd-webui-cutoff https://github.com/hnmr293/sd-webui-cutoff 89b90487 (Wed Mar 22 15:47:20 2023) unknown stable-diffusion-webui-composable-lora https://github.com/opparco/stable-diffusion-webui-composable-lora.git d4963e48 (Mon Feb 27 17:40:08 2023) unknown stable-diffusion-webui-rembg https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git 64821f04 (Sun Mar 12 15:32:00 2023) unknown stable-diffusion-webui-two-shot https://github.com/ashen-sensored/stable-diffusion-webui-two-shot.git a761ead4 (Wed Mar 15 15:23:33 2023) unknown LDSR [built-in](http://127.0.0.1:7860/) Lora [built-in](http://127.0.0.1:7860/) ScuNET [built-in](http://127.0.0.1:7860/) SwinIR [built-in](http://127.0.0.1:7860/) prompt-bracket-checker [built-in](http://127.0.0.1:7860/)

Console logs

Launching Web UI with arguments: --autolaunch --xformers --ckpt-dir M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable-diffusion-webui\models\Stable-diffusion --vae-path M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\models\VAE\vae-ft-mse-840000-ema-pruned.safetensors
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json
Civitai Helper: No setting file, use default
reading lora M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\models\Lora\blank.safetensors: AssertionError
Traceback (most recent call last):
  File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 84, in __init__
    self.metadata = sd_models.read_metadata_from_safetensors(filename)
  File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\modules\sd_models.py", line 221, in read_metadata_from_safetensors
    assert metadata_len > 2 and json_start in (b'{"', b"{'"), f"{filename} is not a safetensors file"
AssertionError: M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\models\Lora\blank.safetensors is not a safetensors file

Checkpoint chilloutmix_NiPrunedFp32Fix.safetensors [fc2511737a] not found; loading fallback 3moonCartoonREALMost_3moonExtremeREALMost.safetensors [6b9ccc7e4d]
Loading weights [6b9ccc7e4d] from M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable-diffusion-webui\models\Stable-diffusion\3moonCartoonREALMost_3moonExtremeREALMost.safetensors
Creating model from config: M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights from commandline argument: M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\models\VAE\vae-ft-mse-840000-ema-pruned.safetensors
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(23): bad-hands-5, bad-image-v2-39000, bad_prompt, bad_prompt_version2, bad_quality, dpin_style, emb-rrf2, ng_deepnegative_v1_75t, nixeu_basic, nixeu_basic2, nixeu_extra, nixeu_soft, nixeu_white, prt, pureerosface_v1, shy_lily, Style-Info, style-sylvamagic, ulzzang-6500-v1.1, ulzzang-6500, vile_prompt3, vmpr, yor_forger
Textual inversion embeddings skipped(6): 21charturnerv2, HyperSmoke, nartfixer, nfixer, nrealfixer, rzminjourney
Model loaded in 4.2s (load weights from disk: 0.2s, create model: 0.6s, apply weights to model: 0.7s, apply half(): 0.7s, load VAE: 0.1s, move model to device: 0.8s, load textual inversion embeddings: 1.0s).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 16.6s (import torch: 2.7s, import gradio: 1.5s, import ldm: 0.4s, other imports: 1.3s, list SD models: 0.2s, setup codeformer: 0.1s, load scripts: 3.6s, load SD checkpoint: 4.3s, create ui: 2.2s, gradio launch: 0.4s).
activating extra network lora: SafetensorError
Traceback (most recent call last):
  File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\modules\extra_networks.py", line 85, in activate
    extra_network.activate(p, [])
  File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\extensions-builtin\Lora\extra_networks_lora.py", line 23, in activate
    lora.load_loras(names, multipliers)
  File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 214, in load_loras
    lora = load_lora(name, lora_on_disk.filename)
  File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 133, in load_lora
    sd = sd_models.read_state_dict(filename)
  File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\modules\sd_models.py", line 241, in read_state_dict
    pl_sd = safetensors.torch.load_file(checkpoint_file, device=device)
  File "M:\00000 001 PORTAFOLIO\00001 STABLE DIFFUSION\stable2xformerson\stable-diffusion-webui\venv\lib\site-packages\safetensors\torch.py", line 99, in load_file
    with safe_open(filename, framework="pt", device=device) as f:
safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooSmall

100%|██████████████████████████████████████████████████████████████████████████████████| 32/32 [00:12<00:00,  2.63it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 32/32 [00:17<00:00,  1.81it/s]

Additional information

No response

@mateocarcasi mateocarcasi added the bug-report Report of a bug, yet to be confirmed label Mar 27, 2023
@bryanray
Copy link

dont use it, it is broken, use extra-network as your only solution,

if you use that dropdown menu lora, somehow you forget it, and you get unexpected result, that will drive you mad for hours...then you figure out it is that silly thing :)

just use extra network that red little button to choose and add as tag

@Akis-M
Copy link

Akis-M commented Mar 27, 2023

dont use it, it is broken, use extra-network as your only solution,

if you use that dropdown menu lora, somehow you forget it, and you get unexpected result, that will drive you mad for hours...then you figure out it is that silly thing :)

just use extra network that red little button to choose and add as tag

@bryanray yeah well the fking UI remembers the LORA you selected from last session or something and now it's impossible to make it blank again even after compeltely restarting PC or stable diffusion

@mateocarcasi
Copy link
Author

The non official solution for me so far was deleting the config.json and cache.json files it works well but keep and error on the load of imagine generation that I dont now what is doing or afecting because the images are still generating in stable difussion. so it willl be better start over again.

@Fllamber
Copy link

The way I solve it was by adding None at line 55 of the lora_script.py file.

It should be like:
"sd_lora": shared.OptionInfo("None", "Add Lora to prompt", gr.Dropdown, lambda: {"choices": ["None"] + [x for x in lora.available_loras]}, refresh=lora.list_available_loras),

You can also manualy add "sd_lora": "None", in the config.json

@mateocarcasi
Copy link
Author

The way I solve it was by adding None at line 55 of the lora_script.py file.

It should be like: "sd_lora": shared.OptionInfo("None", "Add Lora to prompt", gr.Dropdown, lambda: {"choices": ["None"] + [x for x in lora.available_loras]}, refresh=lora.list_available_loras),

You can also manualy add "sd_lora": "None", in the config.json

great solution

@ProxiEx3
Copy link

Ive tried all of the above tips and it still doesnt work. There is always one lora selected I dont even know how to solve this anymore...

@xyzDist
Copy link

xyzDist commented Apr 7, 2023

Ive tried all of the above tips and it still doesnt work. There is always one lora selected I dont even know how to solve this anymore...

modify "sd_lora": "None", in the config.json works

@acergelff
Copy link

"sd_lora": shared.OptionInfo("None", "Add Lora to prompt", gr.Dropdown, lambda: {"choices": ["None"] + [x for x in lora.available_loras]}, refresh=lora.list_available_loras),

I tried to modify config.json and lora_script.py but it didn’t work, lora is still there.
help me ,plz

@Fllamber
Copy link

For people that are still with difficulties, see if you have any Extensions that would keep the configuration, such as stable-diffusion-webui-state.

Unfortunantely you might have to do these steps:

  1. Go to the Extensions tab
  2. Click on 'Check for updates' and then 'Apply and restart UI'
  3. Deselect any extension that might be causing problems and then click on the button 'Apply and restart UI'
  4. Close webui and reopen.
  5. Do Step 3 and 4 several times disabling extensions that could interfere or be broken until solution.

built-in extensions are considered safe and are not needed to be in this test.
I do not have certainty if this effort will bring any solutions and might be a shot in the dark. Good Luck.

@yooyes
Copy link

yooyes commented Apr 18, 2023

I was thinking about how to solve this problem, and luckily I solved it.

Here's a workaround.

  1. Create a new file in the models/Lora/ path.
  2. Change the file name including the extension. ( none.safetensors )
  3. Now after running sd_lora refresh then select that empty lora.
  4. End the run.
  5. Open the file C:\stable-diffusion-webui\extensions-builtin\Lora\lora.py.
  6. Search for this phrase 'if ext.lower() == ".safetensors":'
    Just below that phrase self.metadata = sd_models.read_metadata_from_safetensors(filename)
    There is.
  7. Modify this part like this.
    try:
    if 'none' not in filename:
    self.metadata = sd_models.read_metadata_from_safetensors(filename)

@davebluke
Copy link

I was thinking about how to solve this problem, and luckily I solved it.

Here's a workaround.

  1. Create a new file in the models/Lora/ path.
  2. Change the file name including the extension. ( none.safetensors )
  3. Now after running sd_lora refresh then select that empty lora.
  4. End the run.
  5. Open the file C:\stable-diffusion-webui\extensions-builtin\Lora\lora.py.
  6. Search for this phrase 'if ext.lower() == ".safetensors":'
    Just below that phrase self.metadata = sd_models.read_metadata_from_safetensors(filename)
    There is.
  7. Modify this part like this.
    try:
    if 'none' not in filename:
    self.metadata = sd_models.read_metadata_from_safetensors(filename)

What's the point of points 5, 6 and 7? It will work with steps 1, 2, 3, and 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

9 participants