nihedon / sd-webui-weight-helper

The extension allows you to specify Lora or Lyco weight from context menu.
MIT License
25 stars 1 forks source link

[Suggestion] Would you consider forking @hako-mikan sd-webui-lora-block-weight and fixing it? #11

Closed diodiogod closed 1 month ago

diodiogod commented 1 month ago

Well, sd-webui-lora-block-weight is stale for 4 months now, and it looks like @hako-mikan is also not active anymore. Would you consider fixing the extension to work again, specially with the new Forge? And it would be even insanely better if you consider adding support for Flux. I have no idea if Flux have blocks in the same way SD15 and SDXL have, but it's the thing I miss the most as a creator to mess with my LoRa blocks to fix some problems with the training.

Anyway, thank you so much! Even without block weights, I use your extension everyday just to change the normal lora weight. I really appreciate your work here.

nihedon commented 1 month ago

@diodiogod I’m sorry, but that’s beyond my capabilities. The development layers for LoRA Block Weight and Weight Helper are different, and I lack the in-depth knowledge of the internal workings of AI image generation. Additionally, the Forge update in August brought significant changes, making it incompatible with the previous version of Forge and A1111.

Like you, I’m also hoping that @hako-mikan, the creator of LoRA Block Weight, will return to development, or that someone else might fork the project. (However, considering the current situation, it seems that hako-mikan might be too busy to continue development...)

I apologize for not being able to meet your expectations, and I appreciate your understanding.

diodiogod commented 1 month ago

I do understand, I had to take a shot and try it! =P I appreciate the work you have done here! Thank you very much ❤

nihedon commented 1 month ago

@diodiogod I took a quick look at the source code, and I found some issues caused by compatibility changes, so I tried to fix them. It seems to be working fine on my local setup, at least for now. https://github.com/nihedon/sd-webui-lora-block-weight

However, due to my limited technical skills, I’m unable to add new features like “support for Flux.” I recommend switching back to the original version if development resumes there.

diodiogod commented 1 month ago

@diodiogod I took a quick look at the source code, and I found some issues caused by compatibility changes, so I tried to fix them. It seems to be working fine on my local setup, at least for now. https://github.com/nihedon/sd-webui-lora-block-weight

However, due to my limited technical skills, I’m unable to add new features like “support for Flux.” I recommend switching back to the original version if development resumes there.

Oh thanks for that! If you manage to fix it for SD and SDXL it wold be amazing already. The lora block weight is loading now with your fork, I can see it's options menu, but unfortunately the image won't change if I apply the blocks comparing to not applying it.

This is what I get in the console:

[LORA] Loaded J:\stablediffusion1111s2\Data\Packages\forge2\models\Lora\Ch-People\Fares_FaresSD15.safetensors for KModel-UNet with 192 keys at weight 0.8 (skipped 0 keys)
[LORA] Loaded J:\stablediffusion1111s2\Data\Packages\forge2\models\Lora\Ch-People\Fares_FaresSD15.safetensors for KModel-CLIP with 72 keys at weight 0.8 (skipped 0 keys)
LoRA Block weight (lora): Fares_FaresSD15_v1: (Te:0.8,Unet:0.8) x [1.0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0, 0, 0, 0.0, 0, 0, 0, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
*** Error running after_extra_networks_activate: J:\stablediffusion1111s2\Data\Packages\forge2\extensions\sd-webui-lora-block-weight\scripts\lora_block_weight.py
    Traceback (most recent call last):
      File "J:\stablediffusion1111s2\Data\Packages\forge2\modules\scripts.py", line 876, in after_extra_networks_activate
        script.after_extra_networks_activate(p, *script_args, **kwargs)
      File "J:\stablediffusion1111s2\Data\Packages\forge2\extensions\sd-webui-lora-block-weight\scripts\lora_block_weight.py", line 541, in after_extra_networks_activate
        loradealer(self, kwargs["prompts"] ,self.lratios,self.elementals,kwargs["extra_network_data"])
      File "J:\stablediffusion1111s2\Data\Packages\forge2\extensions\sd-webui-lora-block-weight\scripts\lora_block_weight.py", line 893, in loradealer
        if go_lbw or load: load_loras_blocks(self, lorans,lorars,te_multipliers,unet_multipliers,elements,ltype, starts=starts)
      File "J:\stablediffusion1111s2\Data\Packages\forge2\extensions\sd-webui-lora-block-weight\scripts\lora_block_weight.py", line 975, in load_loras_blocks
        lbwf(te, unet, lwei, elements, starts)
      File "J:\stablediffusion1111s2\Data\Packages\forge2\extensions\sd-webui-lora-block-weight\scripts\lora_block_weight.py", line 1140, in lbwf
        after_applying_unet_lora_patches = shared.sd_model.forge_objects_after_applying_lora.unet.lora_patches
    AttributeError: 'UnetPatcher' object has no attribute 'lora_patches'

---
To load target model KModel
Begin to load 1 model
Reuse 1 loaded models
[Unload] Trying to free 4356.23 MB for cuda:0 with 0 models keep loaded ...
[Unload] Current free memory is 20747.04 MB ... 
[Memory Management] Current Free GPU Memory: 20747.04 MB
[Memory Management] Required Model Memory: 0.00 MB
[Memory Management] Required Inference Memory: 2225.00 MB
[Memory Management] Estimated Remaining GPU Memory: 18522.04 MB
Patching LoRA by precomputing model weights.
Patching LoRAs for KModel: 100%|██████████| 192/192 [00:00<00:00, 1181.32it/s]
LoRA patching has taken 0.17 seconds
Moving model(s) has taken 0.18 seconds
100%|██████████| 25/25 [00:03<00:00,  7.40it/s]
[Unload] Trying to free 3895.51 MB for cuda:0 with 1 models keep loaded ...
[Unload] Current free memory is 20746.60 MB ... 
Total progress: 100%|██████████| 25/25 [00:04<00:00,  5.70it/s]s]

version: f2.0.1v1.10.1-previous-461-g948e9145  •  python: 3.10.11  •  torch: 2.3.1+cu121  •  xformers: N/A  •  gradio: 4.40.0  •  checkpoint: 68ff402978

nihedon commented 1 month ago

@diodiogod Thank you for the information. It seems the issue is likely due to Forge still being in active development and frequently updated. The version of Forge you’re using is probably different from mine. I’m using version [8e4a6fc].

The variable “lora_patches” that appears in your error log was added on August 31st, so the version you’re using [948e914], which was updated on August 29th, might be causing the error. I’m sorry, but please try using the latest version.

version: f2.0.1v1.10.1-previous-500-g8e4a6fcc  •  python: 3.10.11  •  torch: 2.3.1+cu121  •  xformers: 0.0.27  •  gradio: 4.40.0  •  checkpoint: bf8343aa61

diodiogod commented 1 month ago

@diodiogod Thank you for the information. It seems the issue is likely due to Forge still being in active development and frequently updated. The version of Forge you’re using is probably different from mine. I’m using version [8e4a6fc].

The variable “lora_patches” that appears in your error log was added on August 31st, so the version you’re using [948e914], which was updated on August 29th, might be causing the error. I’m sorry, but please try using the latest version.

version: f2.0.1v1.10.1-previous-500-g8e4a6fcc  •  python: 3.10.11  •  torch: 2.3.1+cu121  •  xformers: 0.0.27  •  gradio: 4.40.0  •  checkpoint: bf8343aa61

I'll try that now! It's working on your commit! GREAT! I'll be using it for now. But, whenever you get the time specially because you already made it work, you could consider fixing it for the current version since using the previous one will eventually get outdated for new features. But I do understand that it might get broken again and again, and it would require more time. So, really, whenever you get the time! Thank you so much. ❤

nihedon commented 1 month ago

From now on, we’ll continue the discussion in the issues of the following repository, so I’ll close this issue. https://github.com/nihedon/sd-webui-lora-block-weight