deforum-art / sd-webui-deforum

Deforum extension for AUTOMATIC1111's Stable Diffusion webui
https://deforum.github.io
Other
2.7k stars 390 forks source link

Merge denoising_strength_schedule with strength_schedule #3

Closed kabachuha closed 2 years ago

kabachuha commented 2 years ago

The denoising_strength_schedule is basically strength_schedule, but within the webui. So it should be easy to map strength_schedule from vanilla Deforum to denoising_strength_schedule. So strength_schedule will be essentially converted denoising_strength_schedule and the 'denoising_strength_schedule' param will be removed from this script

image

kabachuha commented 2 years ago

Screenshot 2022-10-17 at 00-34-02 deforum-for-automatic1111-webui_generate py at automatic1111-webui · deforum-art_deforum-for-automatic1111-webui

image

image

kabachuha commented 2 years ago

Uh, no. The previous comment is wrong, it's giving weird results greater than one, but it's also shedding light on the vanilla/this script mismatch. I should equate t_enc instead. https://github.com/deforum/stable-diffusion/blob/main/Deforum_Stable_Diffusion.ipynb

Screenshot 2022-10-17 at 01-12-12 deforum_stable-diffusion

kabachuha commented 2 years ago

Or not? image

kabachuha commented 2 years ago

I think i'll just implement it for both versions then

rewbs commented 2 years ago

This doesn't look quite right to me, and it's causing me to get garbage results with opt.img2img_fix_steps enabled.

As far as I understand, the option opt.img2img_fix_steps just impacts the value of steps when doing img2img. I don't think you need to change denoising_strength based on this option.

So p.denoising_strength = 1 - args.strength like you have in the else branch is always the way to go IMO.

kabachuha commented 2 years ago

I recommended to turn off opt.img2img_fix_steps in README when using Deforum after a number of complaints

enn-nafnlaus commented 1 year ago

Okay, is there anyway to get denoising strength down? Because this code is consistently turning it into 0.9523809523809523 because args.strength==0 and args.steps==20, so I get no bloody consistency :( Can't seem to get it to change by tweaking strength_schedule, at all. And obviously I can't get steps down far enough to make a difference when args.strength==0. Seems there's a disconnect somewhere, like something should be setting args.strength but isn't.

I'm trying updating now to see if it helps.

rewbs commented 1 year ago

@enn-nafnlaus to reduce denoising strength, increase the Deforum strength parameter. The denoising_strength sent to the generation step is just 1-strength. So 0.6 strength will result in 0.4 denoising_strength.

If that's not working as you expect, it would be good to see you full settings.

enn-nafnlaus commented 1 year ago

It does not do that, as I mentioned. I have it set to 0,65, but it's equal to zero (according to my added debugging statements) in the above section of code. Updating did not help.

deforum_video-settings.txt

deforum_settings_condemner.txt

This has been driving me mad for weeks. :( I just noticed the reference to this issue in the code itself and thus followed the link.

rewbs commented 1 year ago

Scanning through those settings I think you could be hitting this condition which sets the strength to 0: https://github.com/deforum-art/deforum-for-automatic1111-webui/blob/automatic1111-webui/scripts/deforum_helpers/generate.py#L148

The various init / strength settings are a bit confusing but you could try unchecking strength_0_no_init and/or checking use_init and/or setting the non-scheduled strength slider value to a non-zero value.

rewbs commented 1 year ago

Oh, the other thing is: you mentioned denoising strength landing on 0.9523809523809523 which suggests you need to disable this option in the main a1111 settings:

image

You'll get garbage if keep it enabled. (I believe this is a bug, but the advice above from @kabachuha is just to disable the setting.)

enn-nafnlaus commented 1 year ago

Oh, the other thing is: you mentioned denoising strength landing on 0.9523809523809523 which suggests you need to disable this option in the main a1111 settings:

That's surely it, I do have that enabled! I hate having the UI tweak my steps for me. Guess I'll have to try Deforum with it disabled!

This was maddedning - glad to know there's a (probable) solution!

enn-nafnlaus commented 1 year ago

ED: Nope. :Þ That just makes it worse! Denoising strength goes to 1.0 if I uncheck it.

enn-nafnlaus commented 1 year ago

The various init / strength settings are a bit confusing but you could try unchecking strength_0_no_init and/or checking use_init and/or setting the non-scheduled strength slider value to a non-zero value.

strength_0_no_init: no help use_init: no help non-scheduled strength: Works! Though can't be scheduled

enn-nafnlaus commented 1 year ago

For now I'm putting in an annoying hack to break my project up into chunks to adjust the non-scheduled strength manually (I need it to decrease over time). This requires manually slicing up the source videos into chunks and readjusting, as well as being unable to batch the whole process up all at once. So it'd be nice to get this fixed. But at least there's a stopgap I can work with!

(Another nice feature, although it'd be a request not a fix, would be the ability to schedule face restoration. Because at times it'll add faces where there aren't any, so you want it off at those times, while at others it'll do a wonderful job at increasing coherency)

enn-nafnlaus commented 1 year ago

Whoa hey - I just updated Deforum, the above code is gone, and denoising schedules work. Yeay!

enn-nafnlaus commented 1 year ago

AHA!

So, it wasn't actually gone. In my test to see if "it was gone", I just used the default model (snowy painting by Rutkowski) - and that worked fine with denoising strength. But with one simple but important change - yes, this can be reproduced! - denoising strength goes to 1:

Switch animation to "Video Input" and enter a video_input_path.

That was the difference. Denoising schedules in strength_schedule get ignored if you use a video input. You can only control denoising with the (fixed) strength slider. Is there a reason for this, or is it (as it seems, from a user perspective) a bug?