sd-webui-controlnet icon indicating copy to clipboard operation
sd-webui-controlnet copied to clipboard

"Read Generation From Prompt" Support

Open Neverdusk opened this issue 2 years ago • 8 comments

It would be incredibly useful if pressing the "Read Generation Parameters From Prompt" button also filled in this extension's ControlNet info. I often use mildly complex multi-ControlNet setups, so applying them to ControlNet each time I open the WebUI can involve meticulously copying each setting and slider back into it's right position.

If somehow, pressing the button would also read and fill in the ControlNet metadata saved with each prompt, that would make sessions much easier and faster to set up. It would also make it much easier to switch between different ControlNet setups entirely.

Neverdusk avatar Feb 27 '23 17:02 Neverdusk

This is great -- I have also searched for a way to improve the controlnet setup process -- i have a few questions:

  1. where exactly is the "Read Generation Parameters From Prompt" button?
  2. Is this generating from metadata in the PNG? I often use the same prompt with different settings for different purpose.

Thanks!

marcsyp avatar Feb 27 '23 23:02 marcsyp

where exactly is the "Read Generation Parameters From Prompt" button?

See here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/javascript/hints.js#L17

Seems to be the button that pastes last generation info into the gradio components.

image

ljleb avatar Feb 27 '23 23:02 ljleb

  1. Is this generating from metadata in the PNG? I often use the same prompt with different settings for different purpose.

Yes - ControlNet actually allows for a lot of consistent shapes and poses, so I've actually set up different templates to create characters from. So I end up reusing ControlNet settings a lot between sessions and making only minor adjustments here and there. For example, to draw a character portrait at a specific angle.

It's not too unlike reusing prompts themselves, so being able to press the Read button and have it also fill in ControlNet would be really convenient. Especially when working with Multi-ControlNet.

Neverdusk avatar Feb 28 '23 00:02 Neverdusk

Thanks, I have used that button recently but didn't understand what it was doing, because I used it in txt2img and it pulled a random set of parameters (maybe the last image generated?). I will have to test this in img2img, I assume if you drop an image into the source pane and hit the button, it will read the metadata and populate the various configuration.

For controlnet, I would expect it to populate the model, preprocessor, preproc res, and thresholds, but not the source image (I'm happy to do that on my own and it's likely cumbersome to store as metadata (filepath reference)).

I agree, this would be VERY, VERY useful -- I would say that it would be great if the setup could be replicated when using the various "send to" buttons as well, because txt2img doesn't have a source image to copy generation parameters from.

I posted an issue yesterday to at least have the preprocessor metadata stored with the png (resolution and thresholds), because they have such a huge effect on the image results, and I often lose my setup because of experimentation or having to reload, and it can be hard to get back to that sweet spot that you thought wasn't good enough but turns out is the best you had. :)

marcsyp avatar Feb 28 '23 05:02 marcsyp

The button reads the metadata you put in the prompt field, not from any PNG. So you have to paste metadata text into the prompt and then press the button. Works for text2img and img2img.

I tend to copy and save the metadata outputted down beneath each generated image, which I can then copy back in with Read whenever I want. ControlNet metadata is already included in that text, including preprocessor, model, guidance, etc. So I'm just requesting that it can be Read back in, since the Read button currently ignores that metadata.

And yes, if you leave the prompt field empty, the Read button copies the last prompt. But if you put in actual metadata, it'll scan in that instead - including model, steps, size, hiresfix, and any other built-in text2img / img2img settings.

Neverdusk avatar Feb 28 '23 12:02 Neverdusk

Anyone working on this by chance? This would be a great workflow enhancement, as it is control painstaking to setup controlnets and switching between projects.

marcsyp avatar Mar 09 '23 05:03 marcsyp

Also, please note my relate Issue https://github.com/Mikubill/sd-webui-controlnet/issues/399#issue-1600272521

marcsyp avatar Mar 09 '23 05:03 marcsyp

This is one of the reasons I haven't really adopted ControlNet yet. There is no way to record how you generated an image, unless you do it by hand. None of the metadata of which image or its settings is stored with the generated images, so regenerating them later is a difficult task.

I really like Ateist's idea of adopting the format of LoRAs in the prompt itself to store that metadata, something like <controlnet:openpose="filename", guidance:0.2>.

The only additional thing would be the images themselves used as input, but I guess those could be stored in a kind of "library" folder somewhere.

Jonseed avatar Apr 06 '23 22:04 Jonseed

still doesn't work, atleast for me on the latest version.

Guilhermesscastro avatar May 08 '23 11:05 Guilhermesscastro

I wish it could read that metadata for controlnet as well. It would really make the process so much easier!

Kubanis avatar May 15 '23 11:05 Kubanis

Yeah, controlnet is fine for one off images, but SD by it's very nature requires a lot of testing x/y/z plotting, and using controlnet to that end is frustrating. Seconding the idea about being able to specify controlnet settings inside the prompt. It would also conveniently ensure settings get recorded in the metadata with no extra coding hassle.

PaperOrb avatar May 28 '23 00:05 PaperOrb