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

Someone please push the FIX to the main branch!!! #43

Open
RazredgeBR opened this issue May 23, 2023 · 7 comments
Open

Someone please push the FIX to the main branch!!! #43

RazredgeBR opened this issue May 23, 2023 · 7 comments

Comments

@RazredgeBR
Copy link

RazredgeBR commented May 23, 2023

On the first report of this issue #40 people are reporting that the fix is very simple, just changing two lines of code is apparently enough to fix:

line 371: lora.mtime = os.path.getmtime(lora_on_disk)

line 373: sd = sd_models.read_state_dict(lora_on_disk)

Issue #40 (comment)

But some of us are working on certain constraints, and speaking for myself, I can't edit any files on the Colab I run A1111, and therefore I cannot apply this fix myself. I can either use the extension as is, or not use it at all!

So, any dev, could you please push a fix to the main branch so we can go back to things working?

@riade3788
Copy link

How are you still using colab ..i thought they banned the code

@RazredgeBR
Copy link
Author

How are you still using colab ..i thought they banned the code

I'm using this notebook:
https://colab.research.google.com/github/sagiodev/stablediffusion_webui/blob/master/StableDiffusionUI_ngrok_sagiodev.ipynb

@riade3788
Copy link

the fix you are asking to push didn't work for me

@RazredgeBR
Copy link
Author

God dammit, seems to work for some not for others...

@Taxiozaurus
Copy link

After looking at the current "fix" I've changed it up a little to look like this:

--- a/scripts/main.py
+++ b/scripts/main.py
@@ -368,9 +368,14 @@ KRON_KEY = {
 def load_lora(name, lora_on_disk):
     print('locon load lora method')
     lora = LoraModule(name, lora_on_disk)
-    lora.mtime = os.path.getmtime(lora_on_disk.filename)
+    lora_filename = ''
+    if (isinstance(lora_on_disk, str)):
+        lora_filename = lora_on_disk
+    else:
+        lora_filename = lora_on_disk.filename

-    sd = sd_models.read_state_dict(lora_on_disk.filename)
+    lora.mtime = os.path.getmtime(lora_filename)
+    sd = sd_models.read_state_dict(lora_filename)
     is_sd2 = 'model_transformer_resblocks' in shared.sd_model.lora_layer_mapping

     keys_failed_to_match = []
@@ -608,7 +613,7 @@ def load_lora(name, lora_on_disk):

     if len(keys_failed_to_match) > 0:
         print(shared.sd_model.lora_layer_mapping)
-        print(f"Failed to match keys when loading Lora {lora_on_disk.filename}: {keys_failed_to_match}")
+        print(f"Failed to match keys when loading Lora {lora_filename}: {keys_failed_to_match}")

     return lora

~

It is a very haphazard bandage and not the prettiest looking.

Problem is that I'm not sure about how it should interact with the larger codebase. Especially with new version of A1111 having the "LoRa Alias" thing that introduced LoRa as objects into the code, instead of plain string.

Hence I'm not making a pull request with these changes.

@RazredgeBR
Copy link
Author

I guess this is how people feel when a game update breaks all the mods.

@lcmiracle-yh
Copy link

I figure I'll mention here that, in the ReadMe.md of locon it says:
This extension is basically deprecated and will not have any official update at all. Please consider to use a1111-sd-webui-lycoris instead (but if there are new PRs, I will accept them)
Back over in A1111 repo KohakuBLueleaf pushed for replacing Locon with Lycoris AUTOMATIC1111/stable-diffusion-webui#8169 (reply in thread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants