AUTOMATIC1111 / stable-diffusion-webui-extensions

Extension index for stable-diffusion-webui
504 stars 266 forks source link

m9 prompt extensions #319

Closed MarcusNyne closed 4 months ago

MarcusNyne commented 5 months ago

Info

There are two extensions included here. They have similar functionality but have key differences. I have been using them extensively and found them to be very useful. There is detailed documentation in README.md. Please review for more details. The direct github urls are:

https://github.com/MarcusNyne/sd-scramble-prompts-m9 https://github.com/MarcusNyne/sd-tweak-weights-m9

Feel free to discord me any questions. @marcusnyne

Thank you!!!

Checklist:

w-e-w commented 5 months ago

issues that are in both extensions



Create info text file this means getting the output directory name is not as straightforward I believe it may simplify the writing of info if you register a call back with on_before_image_saved on_before_image_saved this way you directly have access to the final file path where the image is saved depends on your use case you could either register a call back and then remove it immediately after words or write a permanent call back that will be used conditionally

Create variation folders if you want to create a subdirectory group it is also possible for you to "temporarily" append to the following pattern of shared.opts.directories_filename_pattern and unabe save in sube dir then restroing the setting beck

note as the name would suggest directories_filename_pattern is a pattern similer to the image file name pattern

code like this shoud work

# save original settings 
original_directories_filename_pattern = shared.opts.directories_filename_pattern
original_save_to_dirs = shared.opts.save_to_dirs

if chk_variation_folders:
    original_directories_filename_pattern
    try:
        if shared.opts.save_to_dirs:
            shared.opts.directories_filename_pattern = shared.opts.directories_filename_pattern + '/[datetime<%Y%m%d-%H%M%S>]'
        else:
            shared.opts.directories_filename_pattern = '[datetime<%Y%m%d-%H%M%S>]'
        shared.opts.save_to_dirs = Ture

        # image save after this before will be saed into sub dir

    finally:
        # restore original setting in final block to make sure the setting is restored
        shared.opts.directories_filename_pattern = original_directories_filename_pattern
        shared.opts.save_to_dirs = original_save_to_dirs

this is hand to type untested code


using InputAccordions removed all the JavaScript (apart from the hints) and CSS making a code base easy to maintain

image

if you go with the sub multiple tabs route I mentiond above then I have no issue with you using controlnet style


your code structure can lead to potential issues in the future

best restructure it like so

extention root
├── README.md
├── your_libs_under_unique_name_across_webui/
│   ├── __init__.py                           <-- optional: depends on if you want to make a package or not doesn't really matter
│   ├── your_lib_1.py
│   └── your_lib_2.py
└── scripts/
    └── best_to_have_one_file_only.py

in best_to_have_one_file_only.py

import your_libs_under_unique_name_across_webui

issue with Tweak Weights

it't doesn't seem to function correctly

I'm not sure what your intention is either it's supposed to replace prompts or replace lora for me when it replaces prompts with different weights it literally just appended :0.123 after the prompt, but without the parenthesis so the syntax is incorrect, you also have a lora weight, but I've also wasn't able to get it working with lora so that is extra confusing


conclusion


transparency I'm currently also working on an extension, but it's purely function as an extension of XYZ I will say your use case is a bit different from mine, but there's also quite a crossover https://github.com/w-e-w/sd-webui-xyz-addon

w-e-w commented 5 months ago

what does [m9] mean?

light-and-ray commented 5 months ago

MarcusNyne maybe

MarcusNyne commented 5 months ago

@w-e-w , thank you for taking the time to offer comprehensive feedback. Somehow I didn't notice your comment, but I noticed when @light-and-ray commented. Many of your comments are highly technical and I will need to review in detail. I will offer some initial responses, though.

I found a bug when a 0 is entered for certain configurations. I'll fix the bug and review your feedback in more detail. Again, thanks for taking the time to review my extensions.

MarcusNyne commented 5 months ago

MarcusNyne maybe

@light-and-ray , are you available on discord? I'm working in the extensions update code which doesn't seem to work for branches. I can see you have worked in this area in March. Can we have a conversation on discord about it? My username is marcusnyne.

I see dry_run=True on the fetch call .. not sure why this is supposed to work since FETCH_HEAD is only updated on installation.

Searched for you in the webui-dev channel but couldn't find you.

light-and-ray commented 5 months ago

I'm not interested in it

w-e-w commented 5 months ago

MarcusNyne maybe

@light-and-ray , are you available on discord? I'm working in the extensions update code which doesn't seem to work for branches. I can see you have worked in this area in March. Can we have a conversation on discord about it? My username is marcusnyne.

I see dry_run=True on the fetch call .. not sure why this is supposed to work since FETCH_HEAD is only updated on installation.

Searched for you in the webui-dev channel but couldn't find you.


sorry I believe have accidentally ping light-and-ray

MarcusNyne commented 4 months ago

@w-e-w, I completed the changes to the extensions. Here is a comprehensive response to your feedback. Thank you for the detailed feedback.

Changes

Other Feedback

w-e-w commented 4 months ago

I still think the Stable Diffusion: Tweak Weights is working very weirdly as mentioned above but I don't want to care anymore so I'll just let that is an index and let you deal with it

MarcusNyne commented 4 months ago

@w-e-w , I wasn't able to reproduce your problem with Tweak Weights. Can you show me an example of a prompt that will reproduce the problem?

I appreciate your help and would like to fix it if I can reproduce it.

Thanks