Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

jtkelm2
Copy link

@jtkelm2 jtkelm2 commented Sep 7, 2022

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.

Copy link
Contributor

@akx akx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some Python style and maintainability suggestions...

scripts/webui.py Outdated Show resolved Hide resolved
scripts/webui.py Outdated Show resolved Hide resolved
scripts/webui.py Outdated Show resolved Hide resolved
scripts/webui.py Outdated Show resolved Hide resolved
scripts/wildcards/adjective.txt Show resolved Hide resolved
scripts/wildcards/artist.txt Outdated Show resolved Hide resolved
scripts/wildcards/genre.txt Outdated Show resolved Hide resolved
@@ -0,0 +1,19 @@
trending on ArtStation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to sort this file (and keep it sorted).

scripts/wildcards/style.txt Outdated Show resolved Hide resolved
jtkelm2 and others added 4 commits September 7, 2022 13:38
Co-authored-by: Aarni Koskela <[email protected]>
Co-authored-by: Aarni Koskela <[email protected]>
Co-authored-by: Aarni Koskela <[email protected]>
Co-authored-by: Aarni Koskela <[email protected]>
@TingTingin
Copy link
Contributor

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

@jtkelm2
Copy link
Author

jtkelm2 commented Sep 8, 2022

@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.

@TinyBeeman
Copy link
Contributor

@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 :)

@TingTingin
Copy link
Contributor

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
Copy link
Contributor

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

@TinyBeeman
Copy link
Contributor

TinyBeeman commented Sep 8, 2022

@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.

@kalkal11
Copy link

kalkal11 commented Sep 17, 2022

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.

@jtkelm2
Copy link
Author

jtkelm2 commented Sep 17, 2022

@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.

@Sygil-Dev Sygil-Dev deleted a comment from sonarqubecloud bot Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants