stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: loras not working on new update

Open sajith2505 opened this issue 1 year ago • 30 comments

Is there an existing issue for this?

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

What happened?

since new update when i try to use loras get the error below and images dont come out with loras implemented

Steps to reproduce the problem

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

What should have happened?

output images with my loras

Commit where the problem happens

b08500c

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--xformers --theme=dark --autolaunch

List of extensions

image

Console logs

loading Lora C:\StableDiffusion\stable-diffusion-webui\models\Lora\Trained\rad.safetensors: AttributeError9,  3.06it/s]
Traceback (most recent call last):
  File "C:\StableDiffusion\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 218, in load_loras
    lora = load_lora(name, lora_on_disk.filename)
  File "C:\StableDiffusion\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 137, in load_lora
    is_sd2 = 'model_transformer_resblocks' in shared.sd_model.lora_layer_mapping
  File "C:\StableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1614, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'LatentDiffusion' object has no attribute 'lora_layer_mapping'

Additional information

No response

sajith2505 avatar May 13 '23 16:05 sajith2505

Possible duplicate of #10326. Switch to the previous stable release for now.

highnrgappalachian avatar May 13 '23 17:05 highnrgappalachian

#10326, might be related but I was having both issues, characters dropping out of LoRA names with that issue, and this issue of 'LatentDiffusion' object has no attribute 'lora_layer_mapping'

I figured out some models seem to let me "load" the LoRA without this error, then I can switch models and the error goes away for now.

retronomi avatar May 13 '23 21:05 retronomi

Looks like a fix will be released soon based on the 1.2.1 candidate in the dev branch.

Soulreaver90 avatar May 13 '23 21:05 Soulreaver90

Yup, same, loras are all faulting out. Great not just me. How do you roll back to the last working version? There's a code you can input to force it to a version right? I don't remember how to do it.

Ah right.

"git log

Pick the hash you want

git checkout "

hmm, I think I went to one from a few days ago and it's still not recognizing the loras. Is it a conflict in the new controlnet?

This is the error, rolling back didn't help, it didn't have an issue till I updated all my plugins, which i did to get the new controlnet. This happens for every lora I try to use.

loading Lora L:\supersd2\stabdif3\models\Lora\1970RetroFuturism.safetensors: AttributeError Traceback (most recent call last): File "L:\supersd2\stabdif3\extensions-builtin\Lora\lora.py", line 218, in load_loras lora = load_lora(name, lora_on_disk.filename) File "L:\supersd2\stabdif3\extensions-builtin\Lora\lora.py", line 137, in load_lora is_sd2 = 'model_transformer_resblocks' in shared.sd_model.lora_layer_mapping File "L:\supersd2\stabdif3\venv\lib\site-packages\torch\nn\modules\module.py", line 1614, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'lora_layer_mapping'

chimera15 avatar May 14 '23 03:05 chimera15

I had the same problem, but I found that it could be solved by switching CheckPoint once

neavo avatar May 14 '23 04:05 neavo

I had the same problem, but I found that it could be solved by switching CheckPoint once

That worked thanks!!

chimera15 avatar May 14 '23 04:05 chimera15

I had the same problem, but I found that it could be solved by switching CheckPoint once

Thanks

moxumbic avatar May 14 '23 06:05 moxumbic

I can't reproduce this one. It is definitely unrelated to #10326 which is fixed in 1.2.1 RC, but does not happen for me.

AUTOMATIC1111 avatar May 14 '23 10:05 AUTOMATIC1111

I can't reproduce this one. It is definitely unrelated to #10326 which is fixed in 1.2.1 RC, but does not happen for me.

the problem still exists in v1.2.1

neavo avatar May 14 '23 12:05 neavo

FYI, running v1.2.1, I've just met this bug, but it went away when I switched checkpoint (and then back) as noted by naevo.

dramumard avatar May 14 '23 19:05 dramumard

I update is now, and i got this error!! and loras dont load!

Error loading script: lora_script.py Traceback (most recent call last): File "F:\SD\stable-diffusion-webui\modules\scripts.py", line 256, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "F:\SD\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "F:\SD\stable-diffusion-webui\extensions-builtin\Lora\scripts\lora_script.py", line 5, in import lora File "F:\SD\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 460, in list_available_loras() File "F:\SD\stable-diffusion-webui\extensions-builtin\Lora\lora.py", line 405, in list_available_loras candidates = list(shared.walk_files(shared.cmd_opts.lora_dir, allowed_extensions=[".pt", ".ckpt", ".safetensors"])) AttributeError: module 'modules.shared' has no attribute 'walk_files'

merecesarchviz avatar May 15 '23 12:05 merecesarchviz

Getting the same issue in v 1.2.1 and was also fixed by swapping checkpoints.

Edit: Oddly the checkpoint swap is now not working...

Marc2629 avatar May 15 '23 12:05 Marc2629

for me swapping checkpoints dont work!

merecesarchviz avatar May 15 '23 13:05 merecesarchviz

Happens to me now too, updated now and yesterday ( around 20 hours ago ) and yesterday worked

edit : which would mean this may be an extension problem since the repo didn't update since 3 days ? I'm not sure if that's true ?

IMPORTANT EDIT 2 : Uninstall the locon, extension y'all... this is it

Mandraw avatar May 17 '23 08:05 Mandraw

None of the solutions here are working for me.

Edit:

Go To Settings > Additional Network and add the path (\stable-diffusion-webui\models\Lora) to: "Extra paths to scan for LoRA models [...]"

https://github.com/kohya-ss/sd-webui-additional-networks/issues/177#issue-1701564848

Fixed it for me

C-Moa avatar May 18 '23 02:05 C-Moa

mine suddenly began to work from night to day! really strange

merecesarchviz avatar May 18 '23 07:05 merecesarchviz

I found a solution,go to extension tab and click "Apply and restart UI",error will be solved,i install locon extension,so i guess this error maybe some extension bug.

hbwjhbwj avatar May 18 '23 11:05 hbwjhbwj

Is the a1111-sd-webui-locon extension still needed for LyCORIS support? I think so, but I couldn't find a definitive answer.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/39ec4f06ffb2c26e1298b2c5d80874dc3fd693ac breaks it completely

loading Lora /ai/stable-diffusion-webui/stable-diffusion-webui/models/Lora/somefolder/somelora.safetensors: TypeError
Traceback (most recent call last):
  File "/ai/stable-diffusion-webui/stable-diffusion-webui/extensions/a1111-sd-webui-locon/scripts/../../../extensions-builtin/Lora/lora.py", line 253, in load_loras
    lora = load_lora(name, lora_on_disk)
  File "/ai/stable-diffusion-webui/stable-diffusion-webui/extensions/a1111-sd-webui-locon/scripts/main.py", line 367, in load_lora
    lora.mtime = os.path.getmtime(filename)
  File "/home/kadah/anaconda3/envs/a1111/lib/python3.10/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
TypeError: stat: path should be string, bytes, os.PathLike or integer, not LoraOnDisk

I've submitted a PR for the above with a1111-sd-webui-locon. https://github.com/KohakuBlueleaf/a1111-sd-webui-locon/pull/39

Kadah avatar May 21 '23 00:05 Kadah

Mine just stopped working with all these error below. i've tried changing CKPT, --reset, but none of those work.

Error loading script: inpaint.py Traceback (most recent call last): File "C:\ai\stable-diffusion-webui\modules\scripts.py", line 257, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "C:\ai\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\ai\stable-diffusion-webui\extensions\stable-diffusion\scripts\inpaint.py", line 7, in from main import instantiate_from_config File "C:\ai\stable-diffusion-webui\extensions\stable-diffusion\main.py", line 20, in from ldm.data.base import Txt2ImgIterableBaseDataset ModuleNotFoundError: No module named 'ldm.data.base'

Error loading script: knn2img.py Traceback (most recent call last): File "C:\ai\stable-diffusion-webui\modules\scripts.py", line 257, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "C:\ai\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\ai\stable-diffusion-webui\extensions\stable-diffusion\scripts\knn2img.py", line 12, in import scann ModuleNotFoundError: No module named 'scann'

Error loading script: train_searcher.py Traceback (most recent call last): File "C:\ai\stable-diffusion-webui\modules\scripts.py", line 257, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "C:\ai\stable-diffusion-webui\modules\script_loading.py", line 11, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\ai\stable-diffusion-webui\extensions\stable-diffusion\scripts\train_searcher.py", line 3, in import scann ModuleNotFoundError: No module named 'scann'

xleonoelx avatar May 24 '23 09:05 xleonoelx

Just move all your loras to the Lycoris folder (if you don't have it, install lycoris), then trigger them like you would a locon. lyco: instead of lora:

boberto3000 avatar May 24 '23 21:05 boberto3000

My mistake, I meant Lycoris folder, if you don't have that in your models folder install lycoris.

On Wed, May 24, 2023 at 5:52 PM Timothy Maggenti @.***> wrote:

So where is this locon folder to move my loras too, which boberto3000 speaks of?

— Reply to this email directly, view it on GitHub https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10342#issuecomment-1562105979, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3XWJ4CCFO5WXYCLFYH24P3XH2UN7ANCNFSM6AAAAAAYAS7XKM . You are receiving this because you commented.Message ID: @.***>

boberto3000 avatar May 25 '23 06:05 boberto3000

This has just started happing for me after latest commit, 20ae71f may27, none of the solutions above have fixed it , , only solution is to go back to commit c3eced2 of 2 weeks ago

nickr61 avatar May 27 '23 22:05 nickr61

This has just started happing for me after latest commit, 20ae71f may27, none of the solutions above have fixed it , , only solution is to go back to commit c3eced2 of 2 weeks ago

Hi, can you tell me how I can go back to the previous version? I tried "git checkout c3eced2" but it doesn't work.

markivus avatar May 29 '23 01:05 markivus

This has just started happing for me after latest commit, 20ae71f may27, none of the solutions above have fixed it , , only solution is to go back to commit c3eced2 of 2 weeks ago

Hi, can you tell me how I can go back to the previous version? I tried "git checkout c3eced2" but it doesn't work.

I just downloaded the lora.py file off the older(working) commit and replaced it on the current(broken) commit. That solved my issues with the LORA files stopped working.

yoshi244 avatar May 29 '23 02:05 yoshi244

Updating all Extensions (Extensions tab -> check for updates -> apply and restart) worked for me

dPunisher66 avatar May 30 '23 13:05 dPunisher66

Updating extensions is exactly what broke it for me. Update: I did a git pull, and things seem to be working again.

AstroTibs avatar May 31 '23 18:05 AstroTibs

Happens to me now too, updated now and yesterday ( around 20 hours ago ) and yesterday worked

edit : which would mean this may be an extension problem since the repo didn't update since 3 days ? I'm not sure if that's true ?

IMPORTANT EDIT 2 : Uninstall the locon, extension y'all... this is it

Thank you very much this solve the issue for me, I LOVE YOU.

GrayFox200 avatar Jun 20 '23 17:06 GrayFox200

I have updated my extensions and lora is still broken for me.

AttributeError: 'LatentDiffusion' object has no attribute 'lora_layer_mapping'

bbecausereasonss avatar Jun 22 '23 18:06 bbecausereasonss

Might need to update Automatic1111 as well.

check out this helpful YT video (around 4 min mark) on how to set up so Automatic1111 checks for updates every time it starts:

https://www.youtube.com/watch?v=3cvP7yJotUM

the extensions needs to be updated in Automatic1111 [https://www.bing.com/th?id=OVP.GPTwkisq0n2yxXd7LyGCZAEsDh&pid=Api]https://www.youtube.com/watch?v=3cvP7yJotUM Install Automatic 1111 WITH automated Updates - super easy #gitpull #stablediffusionhttps://www.youtube.com/watch?v=3cvP7yJotUM In this video, i will show you how to install and use Automatic 1111 Stable Diffusion and automatically update it with Git Pull to have the newest Version without any fuss! #### Links from the Video #### Python 3.10.6: https://www.python.org/downloads/release/python-3106/ Git for Windows: https://gitforwindows.org/ SD 1.5 Download: https ... www.youtube.com


From: becausereasons @.> Sent: Friday, June 23, 2023 12:06 AM To: AUTOMATIC1111/stable-diffusion-webui @.> Cc: dPunisher66 @.>; Comment @.> Subject: Re: [AUTOMATIC1111/stable-diffusion-webui] [Bug]: loras not working on new update (Issue #10342)

I have updated my extensions and lora is still broken for me.

AttributeError: 'LatentDiffusion' object has no attribute 'lora_layer_mapping'

— Reply to this email directly, view it on GitHubhttps://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10342#issuecomment-1603137406, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5C75OMUIN3IPEKPCVKGPZ3XMSGCNANCNFSM6AAAAAAYAS7XKM. You are receiving this because you commented.Message ID: @.***>

dPunisher66 avatar Jun 22 '23 18:06 dPunisher66

Closing as stale.

catboxanon avatar Aug 03 '23 16:08 catboxanon