stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

Added functionality for wildcards (dynamic prompting à la progrock-stable)

Open jtkelm2 opened this issue 2 years ago • 8 comments

Added support so that prompts can contain wildcard terms (indicated by surrounding double underscores), with values instantiated randomly from the corresponding .txt file in the folder /scripts/wildcards/. For example:

a woman at a cafe by __artist__

will draw a random artist from artist.txt. This works independently on each prompt, so that one can e.g. generate a batch of 100 images with the same prompt input using a wildcard, and each output will have a unique artist (or style, or genre, or anything that the user creates their own .txt file for) attached to it.

Instantiations don't appear under the Generation Parameters preview, so to most easily see what the prompt is for each individual image, it may be convenient to have metadata writing enabled, and push to image lab. Or, better yet, update the Generation Parameters functionality so that this is not necessary.

jtkelm2 avatar Sep 07 '22 03:09 jtkelm2

Would be nice if it could have a mode to iteratively go through a file in order also a mode to avoid making a previously selected random choice which would also be similar to going through iteratively but more in the spirit of this feature

TingTingin avatar Sep 08 '22 01:09 TingTingin

@TingTingin I think that with the size of the txt files, the occasional reused artist (on a different seed) wouldn't be much an issue. It would be nice to have a feature that reads a batch of prompts from a txt file, though.

jtkelm2 avatar Sep 08 '22 07:09 jtkelm2

@TingTingin I think that with the size of the txt files, the occasional reused artist (on a different seed) wouldn't be much an issue. It would be nice to have a feature that reads a batch of prompts from a txt file, though.

I actually just submitted a Pull Request for that very feature :)

TinyBeeman avatar Sep 08 '22 08:09 TinyBeeman

Would be nice if it could have a mode to iteratively go through a file in order also a mode to avoid making a previously selected random choice which would also be similar to going through iteratively but more in the spirit of this feature

Seems like this wouldn't be needed as @TinyBeeman added a better iterative prompter so it would be better I guess if this stayed random

TingTingin avatar Sep 08 '22 08:09 TingTingin

@TinyBeeman Is you pr interoperable with this one meaning you can use wildcards in the textbox?

TingTingin avatar Sep 08 '22 08:09 TingTingin

@TinyBeeman Is you pr interoperable with this one meaning you can use wildcards in the textbox?

As long as we merge process_images carefully, they should work together… it might be nice to integrate them. I didn’t support multi-prompt, since I figured people would just list all the combos they want, but this might be more interesting.

I think they serve different purposes, but if someone has a clever use for combining them, I’m interested in hearing it.

We need to do some infrastructure work to clean up process_images anyway. It’s gotten a little unwieldy, and I think a class-based object which manages the giant combinations of lists, wildcards, multi prompts, n_iters and batch_Sizes would make it easier to make these things work together sanely.

TinyBeeman avatar Sep 08 '22 08:09 TinyBeeman

Is this currently working?

I have an artist.txt file in /scripts/wildcards

Using __artist__ and results seem to be random, however not based on the contents of the file.

I verified this by leaving only giger in the file and the results are nothing like his work.

kalkal11 avatar Sep 17 '22 02:09 kalkal11

@caacoe The pull request hasn't been accepted yet. You can check out Automatic's webui, though, where I have a working script in the wiki.

jtkelm2 avatar Sep 17 '22 09:09 jtkelm2