w-e-w / sd-webui-hires-fix-tweaks

Add additional options and features to hires fix of Stable Diffusion web UI
GNU Affero General Public License v3.0
38 stars 1 forks source link

Add Functions from hires fix plus #10

Open Krek12 opened 1 month ago

Krek12 commented 1 month ago

https://github.com/lihaoyun6/sd-webui-Hires-fix-Plus

after new updates with SD webui it stopped working and there were a couple of interesting features there

w-e-w commented 1 month ago

@Krek12 I'm a bit confused

are you saying that my extension sd-webui-hires-fix-tweaks broke after the update I pushed a couple of hours ago if so describe how it is not working and provide error logs and detail information about your setup

or are you saying that sd-webui-Hires-fix-Plus has stopped working and you wish me to add the Steps optimization and Rolling factor to my extension

Krek12 commented 1 month ago

@Krek12 I'm a bit confused

or are you saying that sd-webui-Hires-fix-Plus has stopped working and you wish me to add the Steps optimization and Rolling factor to my extension

second

Krek12 commented 1 month ago

you might also be interested in this script.

https://github.com/rmcc3/experiments-progressive-growing

minuse: if you install the b-mab extension, the script stops working No working Adetailer AttributeError: 'StableDiffusionProcessingImg2Img' object has no attribute 'enable_progressive_growing' hires fix no working

but you can use the custom hire fix instead: https://github.com/wcde/custom-hires-fix-for-automatic1111

Krek12 commented 1 month ago

Are you interested in this extension by the way? Maybe you will be interested in some of the features of these extensions and add them for your own

https://github.com/wcde/custom-hires-fix-for-automatic1111 https://github.com/klimaleksus/stable-diffusion-webui-conditioning-highres-fix https://github.com/klimaleksus/stable-diffusion-webui-batched-hires https://github.com/Takenoko3333/sd-webui-reuse-seed-plus https://github.com/Filexor/DeepShrinkHires.fix/tree/dev https://github.com/wcde/sd-webui-kohya-hiresfix https://github.com/portu-sim/sd-webui-bmab

w-e-w commented 1 month ago

or are you saying that sd-webui-Hires-fix-Plus has stopped working and you wish me to add the Steps optimization and Rolling factor to my extension

second

okay great you make me panic


my starting point of this extension was to create an extension that extends the origin of functionality of web UI regarding streamlining the use of high res fixed

my goal is to make what is manually achievable "more easy to do" my intention was not to add extra algorithms my intention was not to add stuff that use other extensions directly or are using different algorithms such as Deep Shrink Hires.fix (aka kohya-hiresfix) controlnet

that's being said I have consider similer things like progressive-growing or Rolling factor

I might consider adding something similar to this if I have time

no promises


Krek12 commented 1 month ago

or are you saying that sd-webui-Hires-fix-Plus has stopped working and you wish me to add the Steps optimization and Rolling factor to my extension

second

okay great you make me panic

my starting point of this extension was to create an extension that extends the origin of functionality of web UI regarding streamlining the use of high res fixed

  • it's add features that can either be achieved through more manual work, as in

    • make some make some type of prompting more easy without editing the entire hires prompt
    • Hires CFG / Seed Batch, you can basically achieve the same by doing a manual txt2img -> upscale -> img2img with a diffrent CFG or Seed

my goal is to make what is manually achievable "more easy to do" my intention was not to add extra algorithms my intention was not to add stuff that use other extensions directly or are using different algorithms such as Deep Shrink Hires.fix (aka kohya-hiresfix) controlnet

that's being said I have consider similer things like progressive-growing or Rolling factor

I might consider adding something similar to this if I have time

no promises

  • experiments-progressive-growing, not surprising it stopped working, the author asked you to literally replace critical files of webui, I'm surprised it even launches
  • sd-webui-reuse-seed-plus don't see too much point doesn't wake you already has perfectly usable reuse seed and randome seed by -1?
  • stable-diffusion-webui-batched-hires I think I already support this
  • sd-webui-kohya-hiresfix there are bugs in wcde's implementation, I intend to fix it but I haven't had time
  • something's all completely upscope of this extension such as sd-webui-bmab
  • stable-diffusion-webui-conditioning-highres-fix I don't really want to add something that has already been implemented by someone else and also I'm hesitant to add something that is specific to inpaint models also this is just an extension that moves a slider from settings to the main UI adding some additional presets and relation between denoise strength if you don't wish to use the extension predefined calculations then you could just move it to the main UI by using quick settings or additional options see wiki/User-Interface-Customizations inpainting_mask_weight
  • I might consider adding some features from are already archived extensions

just consumer interest, your extension in itself has been very helpful to me. Although to be honest I've always wondered why you can't add another pass hires? Kind of like a custom hires fix using multiple upscales. Or use several different Vae for image generation. Or several times hires fix the image instead of Hires batch count which just gives different options instead of improving the image several times in a row

w-e-w commented 1 month ago

there's no reason why you can't, but in most cases a 2x second pass is enough adding a thire 3x is just wasteful also you have to consider your computation power every 2x the competition cost is squared, you easily reach a point that you essentially run out of vram or it takes too long for it to be practical

if you're talking about multiple intermittent steps like progressive-growing or rolling factor you will quickly eventually get to a point that you can't increase the image without massively losing quality because the model is just simply not designed for it

high fix is not upscaling, it is stable diffusion, if you want to upscaling you can use the upscaler

Webui Settings > Postporcessing > Enable postprocessing operations in txt2img and img2img tabs add Simple Upscaller

note: in webui 1.10 the Upscaller is bugged if added to Enable postprocessing operations in txt2img and img2img tabs I have already made a PR to webui to fix this issue

in simple terms the task of a VAE is to convert between latent image used by stable diffusion and the actual image that we humans see is generally not something that you would want to change if you're working with the same base model for so allowing to mix VAE, is not really useful unless your experimenting in which you would need much more control over what a general UI can provide which means that you should write your own scripts

and like you mentioned above if you scale up the image multiple times then you quickly surpass what your computer can practically compute if the factor is pretty small in which case it is essentially a different feature (progressive-growing or Rolling factor) however if you're just talking about looking back the output into the input multiple times then img2img has a Loopback script

it might be it might be interesting to add loopback to txt2img

Hires batch count is implemented differently from loopback like scrips the tldr is at it "injects" extra iterations into the high res pass with different iterations using their different seed the way I implemented is so that it should be compatible with most if not all extensions if I change the scale then all calculation regarding to resolutions what else need to change which would easily break lots of things simply put I cannot change the image resolution among many other things without breaking compatibility with extensions in Hires batch count

Hires batch count essentially creates an additional loop "within the pipeline loopback like scrips are essentially implemented by looping the entire pipeline

Krek12 commented 1 month ago
  • why you can't add another pass hires?

there's no reason why you can't, but in most cases a 2x second pass is enough adding a thire 3x is just wasteful also you have to consider your computation power every 2x the competition cost is squared, you easily reach a point that you essentially run out of vram or it takes too long for it to be practical

if you're talking about multiple intermittent steps like progressive-growing or rolling factor you will quickly eventually get to a point that you can't increase the image without massively losing quality because the model is just simply not designed for it

high fix is not upscaling, it is stable diffusion, if you want to upscaling you can use the upscaler

Webui Settings > Postporcessing > Enable postprocessing operations in txt2img and img2img tabs add Simple Upscaller

note: in webui 1.10 the Upscaller is bugged if added to Enable postprocessing operations in txt2img and img2img tabs I have already made a PR to webui to fix this issue

  • Or use several different Vae for image generation.

in simple terms the task of a VAE is to convert between latent image used by stable diffusion and the actual image that we humans see is generally not something that you would want to change if you're working with the same base model for so allowing to mix VAE, is not really useful unless your experimenting in which you would need much more control over what a general UI can provide which means that you should write your own scripts

  • Or several times hires fix the image instead of Hires batch count which just gives different options instead of improving the image several times in a row
  • Hires batch count is the counterpart of the normal batch count

and like you mentioned above if you scale up the image multiple times then you quickly surpass what your computer can practically compute if the factor is pretty small in which case it is essentially a different feature (progressive-growing or Rolling factor) however if you're just talking about looking back the output into the input multiple times then img2img has a Loopback script

it might be it might be interesting to add loopback to txt2img

Hires batch count is implemented differently from loopback like scrips the tldr is at it "injects" extra iterations into the high res pass with different iterations using their different seed the way I implemented is so that it should be compatible with most if not all extensions if I change the scale then all calculation regarding to resolutions what else need to change which would easily break lots of things simply put I cannot change the image resolution among many other things without breaking compatibility with extensions in Hires batch count

Hires batch count essentially creates an additional loop "within the pipeline loopback like scrips are essentially implemented by looping the entire pipeline

thank you for your reply.

`adding a thire 3x is just wasteful

in this case it's just my interest and desire to experiment with these parameters. I already have a couple of ideas for experiments where you can use 4-6 passes at a time, but unfortunately I do not understand the code at all and unfortunately these are just thoughts. If it's not too much trouble, can you explain how it can be done?

`Or use several different Vae for image generation. In this case I came across an interesting VAE that inverts the picture, but in the hires fix it doesn't. However, I noticed that using this VAE it becomes much easier to pick up different little things in the images for the model. This is basically the reason for this question on my part

https://civitai.com/models/419401?modelVersionId=467269

` and like you mentioned above if you scale up the image multiple times then you quickly surpass what your computer can practically compute

not really, I'm sure there's a way. I just don't see it yet.

`experiments-progressive-growing, not surprising it stopped working, the author asked you to literally replace critical files of webui, I'm surprised it even launches

Frankly speaking here in the files themselves changes are very minimal and if you want you can make a direct extension of this script. I personally checked them and I can say that the author added maximum 6-10 elements.

and in txt.img and ui.py there are ridiculously few of them at all, they are needed only for Stable to show the script line in terms of selection. image

Krek12 commented 1 month ago

I myself personally checked the script several times and as it was said the author used really only one factor copy paste. Adding variables of script operability. Which technically could be done as an extension. But it looks like he doesn't quite have the skills to do that.

w-e-w commented 1 month ago

in this case it's just my interest and desire to experiment with these parameters. I already have a couple of ideas for experiments where you can use 4-6 passes at a time, but unfortunately I do not understand the code at all and unfortunately these are just thoughts. If it's not too much trouble, can you explain how it can be done?

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/82a973c04367123ae98bd9abdf80d9eda9b910e2/scripts/loopback.py the loopback script is it good starting point, study the code and modify it


Frankly speaking here in the files themselves changes are very minimal and if you want you can make a direct extension of this script. I personally checked them and I can say that the author added maximum 6-10 elements.

writing extension and modifying web ui are very different pretty much anything can be done easily just by modifying web UI itself but this is not the case when writing an extension this is especially the case if you're writing a highly integrated extension such as my sd-webui-hires-fix-tweaks

depending on how you want to implement it if you want to implement progressive-growing a similar fashion as loopback script it should is relatively simple

but if you're trying to write an extension that injects into webui pipeling such is the case with my current extension especially Hires batch without damaging anything else (including other extensions which you have no idea what they're doing) it's becomes very very complex

Krek12 commented 1 month ago

like what you want to do is easy? Thak you very musch you replace,I'll try to do my best. = ) By the way, I found a cool script for calculating image sizes and with a little work I added a couple of new options https://github.com/aria1th/sd-webui-convenience-util image