acorderob / sd-webui-prompt-postprocessor

Stable Diffusion WebUI & ComfyUI extension to post-process the prompt, including sending content from the prompt to the negative prompt and wildcards.
MIT License
23 stars 1 forks source link

[Bug] Doesn't work with hires fix #3

Closed Picometer12 closed 11 months ago

Picometer12 commented 12 months ago

Description

Add compatibility for the hires.fix upscaling feature of Automatic1111.

Additional context

This might be more appropriately listed as a bug, but I'm not 100% sure that I'm not missing a setting somewhere or possibly having some kind of interference with a different extension. This extension works perfectly if I have hires fix turned off, but when hires fix is turned on, the tokens that are supposed to be sent to the negative prompt are correctly applied to the negative prompt for the before-upscale image, but then incorrectly applied to the positive prompt during the post-upscale steps.

Repro steps: generate with a prompt such as man, hat, grayscale, <!((woman, long hair, colorful))!> with hi.res enabled vs disabled.

Also, thanks for making this! Awesome stuff. I've been hoping that someone would make a "send to negative" feature ever since the first wildcard extension came out.

acorderob commented 12 months ago

I can't reproduce it. I tested your example with hires fix and It works fine for me. Give me an example with all the settings to test, but i think it might be some other extension interfering.

Picometer12 commented 12 months ago

Apologies, that wasn't actually a very good example (at least with default settings on SD 1.5).

Here's a better example -- I don't know if git does anything to the metadata so here's how it appears in PNG Info tab:

parameters

man, portrait
Negative prompt: glasses
Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 524507735, Size: 512x512, Model hash: e1441589a6, Model: v1-5-pruned, VAE hash: c6a580b13a, VAE: vae-ft-mse-840000-ema-pruned.ckpt, Denoising strength: 0.7, Hires upscale: 2, Hires upscaler: None, Version: v1.6.0 

My prompt was Positive: man, portrait <!glasses!>

When I turn off all extensions except sendtonegative or drop a fresh copy of automatic1111 in a separate folder and install only sendtonegative, I get no glasses if I don't use hires fix and I do get glasses when I use hires.fix

53578-2023-10-13

acorderob commented 11 months ago

I tested with your example and indeed the final image gets glasses.

But this is not caused by the extension, because the metadata is correct ("glasses" end up only in the negative prompt in the upscaled image) and i confirmed that the hires fix phase does not processes again the prompt (the prompt and negative prompt is the same as in the initial phase).

So this is just the result of the settings and possibly the model.

Edit: I'm not so sure anymore. I just tested with the prompt/negative prompt as it would be without the extension and it does generate without glasses. I don't know why it is getting the unprocessed prompt in the hires phase, but i will keep analyzing.

acorderob commented 11 months ago

Apparently A1111 uses different variables for hires fix prompts. Should be fixed now.