Panchovix / stable-diffusion-webui-reForge

GNU Affero General Public License v3.0
364 stars 18 forks source link

[Feature Request]: Compositional Negative Prompts #161

Open Reithan opened 1 week ago

Reithan commented 1 week ago

Is there an existing issue for this?

What would your feature do ?

Currently reForge supports prompt composition (ANDing prompts together) for the positive prompt, but not the negative. This is traced back to code like what's found on ln138 of sd_samplers_cfg_denoiser.py

            cond_composition, cond = prompt_parser.reconstruct_multicond_batch(cond, self.step)
            uncond = prompt_parser.reconstruct_cond_batch(uncond, self.step)

After doing some testing locally, there's apparently nothing blocking us from simply updating all places where the negative/uncondition prompt is being sent through cond_batch rather than multicond_batch type processing.

I don't mind submitting this change myself, but as it touches multiple parts of multiple files, I felt it was best to get some alignment from a Feature Request, first, as this has the possibility of introducing new bugs, or simply complicating some already fragile portions of code.

Proposed workflow

  1. Update negative/uncondition prompt code to use multicondition batching.

Additional information

No response

Panchovix commented 1 week ago

Hi there, thanks for the suggestion. Which files/code besides sd_samplers_cfg_denoiser.py you mean?

Reithan commented 1 week ago

I don't have the temp changes locally still as I reverted it before going further. The initial change is swapping reconstruct_cond_batch for reconstruct_multicond_batch for uncond, but there's a few trickle down changes that need to be made to make that work. It seemed fairly 'simple', but the possibility that there may be trickle-down bugs or incompatibilities bothered me. I forget if all changes were in that single file, but IIRC there was at least 1 other file implicated.