AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Lora suddenly doesn't work after reinstall SD in another drive. #11986

Closed Wolfehart closed 1 year ago

Wolfehart commented 1 year ago

Is there an existing issue for this?

What happened?

At first I moved the entire SD folder to my C: drive from D: drive and found out that it doesn't work. So I deleted the entire folder and reinstall the SD using the 1.0.0-pre method and ran update.bat, added some params and start run.bat. Everything is running ok, able to generate images, but when i added the lora prompt, the generated image is not affected by lora model at all. There are no errors in the console. I've tried using the same seed to generate w/ and w/o lora prompt, they both generated the same image. I'm not sure how to troubleshoot this. Any advice is much appreciated.

Steps to reproduce the problem

  1. Moved folder to C, program produced error.
  2. Reinstall SD, update, and run webui.
  3. All functionality is fine, but image is not affected by lora.

What should have happened?

Image generated should be affected by lora model.

Version or Commit where the problem happens

v1.4.1, v1.5.0

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

Nvidia GPUs (GTX 16 below)

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

Mozilla Firefox, Brave

Command Line Arguments

--precision full --no-half --xformers --medvram

List of extensions

No

Console logs

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.5.0
Commit hash: a3ddf464a2ed24c999f67ddfef7969f8291567be
Launching Web UI with arguments: --precision full --no-half --xformers --medvram
Loading weights [a023e2f477] from C:\AI\sd-1.4.1\webui\models\Stable-diffusion\indigoFurryMix_v45Hybrid.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 12.3s (launcher: 3.6s, import torch: 3.5s, import gradio: 1.0s, setup paths: 0.9s, other imports: 1.1s, load scripts: 1.3s, create ui: 0.5s, gradio launch: 0.2s).
Creating model from config: C:\AI\sd-1.4.1\webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: xformers... done.
Model loaded in 6.7s (load weights from disk: 0.9s, create model: 0.4s, apply weights to model: 4.5s, calculate empty prompt: 0.8s).
Couldn't find network with name argo-08
100%|██████████████████████████████████████████████████████████████████████████████████| 30/30 [00:21<00:00,  1.37it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 30/30 [00:25<00:00,  1.16it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 30/30 [00:19<00:00,  1.53it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 30/30 [00:19<00:00,  1.58it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 30/30 [00:19<00:00,  1.68it/s]

Additional information

I have updated the webui to the latest version via update.bat, The console log was attempted just now. There is a line mentioned "Couldn't find network with name argo-08", it was me testing whether lora prompt is detecting properly or not. My lora name is actually argo-09. The next image generated using argo-09 lora has no error, but generated exactly the same image.

dhwz commented 1 year ago

Delete the lyrocis extension if it's installed. Are you sure there is a argo-08.safetensors file in your Lora folder? Is the path in settings pointing to the right folder?

Wolfehart commented 1 year ago

I don't have lyrocis extension installed. I have placed my the lora file inside webui\models\Lora folder. Previously I did not set any directory settings and it detected properly. I will try setting the directory.

Wolfehart commented 1 year ago

Lora is detected properly under extra network tab. image

somenewaccountthen commented 1 year ago

When you startup is there a Lora_script script error visible? I have that after pull just now. *** Error loading script: lora_script.py Traceback (most recent call last): File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/modules/scripts.py", line 295, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/extensions-builtin/Lora/scripts/lora_script.py", line 7, in <module> import network File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/extensions-builtin/Lora/network.py", line 101, in <module> class ModuleType: File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/extensions-builtin/Lora/network.py", line 102, in ModuleType def create_module(self, net: Network, weights: NetworkWeights) -> Network | None: TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Wolfehart commented 1 year ago

When you startup is there a Lora_script script error visible? I have that after pull just now. *** Error loading script: lora_script.py Traceback (most recent call last): File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/modules/scripts.py", line 295, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/extensions-builtin/Lora/scripts/lora_script.py", line 7, in <module> import network File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/extensions-builtin/Lora/network.py", line 101, in <module> class ModuleType: File "/home/bob_billie_skeeter_johnson/development/ai_playground/imaging/stable-diffusion-webui/extensions-builtin/Lora/network.py", line 102, in ModuleType def create_module(self, net: Network, weights: NetworkWeights) -> Network | None: TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

No errors at all for me, My console logs in exactly like in my initial post.

Wolfehart commented 1 year ago

So what's weird is even reverting back to earlier commit also doesn't work. I'm fairly convinced it's some settings on my PC but I can't figure out what is causing it.

somenewaccountthen commented 1 year ago

Ok maybe my issue is diff. -wrong/deleted-

chrme commented 1 year ago

Couldn't find network with name argo-08

so lora with the name argo-08 BUT on your screenshot i see only argo-09 🤨

Wolfehart commented 1 year ago

Couldn't find network with name argo-08

so lora with the name argo-08 BUT on your screenshot i see only argo-09 🤨

I was making sure that the lora prompt was working. i did a test with argo-08 and argo-09 but both still produce the same result...

somenewaccountthen commented 1 year ago

For me i removed the type hint: i changed: /home/boby_joe/development/ai_playground/imaging/stable-diffusion-webui/extensions-builtin/Lora/network.py

'''class ModuleType: def create_module(self, net: Network, weights: NetworkWeights) -> Network | None: return None'''

to

'''class ModuleType: def create_module(self, net: Network, weights: NetworkWeights) : return None'''

Lora work for me now. (Pretty sure it's not same issue tbh judging by your clean startup. My error is in there and your initial post is clean. Good luck )

49RpK5dY commented 1 year ago

@somenewaccountthen Thanks. That fixed lora for me. I'm on torch: 1.13.0+rocm5.2 and python: 3.9.5 in case that helps narrow down the issue. There is no problem on python: 3.10.12.

bourneash commented 1 year ago

@somenewaccountthen Thanks!! That also fixed my issue after updating to the latest commit. I am on Python 3.9.17.

akx commented 1 year ago

This repo does not officially support Python 3.9 – please upgrade to Python 3.10 to avoid heartache like this in the future.

49RpK5dY commented 1 year ago

This repo does not officially support Python 3.9 – please upgrade to Python 3.10 to avoid heartache like this in the future.

That is unfortunate since the wiki for AMD still refers to a docker image with ubuntu 20.04.

Wolfehart commented 1 year ago

Tried these steps:-

Still generating exact same image w/ and w/o lora prompt with no errors. I'm not sure why it just suddenly doesn't generate LoRA images anymore. I wish it at least generate an error.

Other than upgrading nvidia drivers recently (Already downgraded to old driver version) and maybe a windows update, i don't think I did any other python related stuffs.

Wolfehart commented 1 year ago

Reinstalled windows and it worked, so i didn't really found a way to solve it except by reinstalling windows.