-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add Array Support on main prompt #1503
Conversation
What is the difference between it and wildcards? |
A wild card is chosen at random. There's not guarantee that you would cycle through them all, or that you wouldn't use the same value twice. An array will deterministically cycle through all values. It's also much quicker to use arrays because they can be added/edited right in the prompt rather than in a config file. |
@lllyasviel , just wanted to check if this was on your radar. This is my first contribution, let me know if there's something else I should do to move it along. Or if you're not interested in pulling. Thanks! |
Hi Guys, can this be please reviewed/merged so we can start using this amazing feature. |
@mashb1t is there anything I can do to get this approved/merged. Looks like a few people are interested. |
@flanneryhbh as much as i'd also want to see this feature merged there is nothing we can do. The Fooocus core dev team will be back mid/end of January, see update_log.md
|
I've given it a test and it works as advertised, awesome. Just what I wanted. A nice extra feature would be some sort of auto image number setting. I would be handy if there was a checkbox to mean it would automatically run the number of images to match the number of combinations. I guess it might be good if the Generate button told you how many images it was about to create "Generate 12 images". But I'm guessing that would involve changing when the prompt is parsed, I've not really looked at the code in any detail yet. And a clearly much more involved feature would be to have a label under the output images showing you the array combinations used for that image. |
Perhaps it makes sense to use a syntax that is also used in other systems. In ComfyUi the syntax is like this: In Automatic1111 the same, but without brackets: |
This doesnt seem to be working in the current version. |
The pipe (|) notation in ComfyUi and Automatic1111 seem to be a wildcard system, where it picks a random value from the list. The array concept is deterministic, as it will cycle through the values in order. I think that's a way better feature. I'll leave the wildcard notation free for someone else to implement. |
I’ve made my own additional changes to this to make it more flexible. They allow it to be used for applying arrays to prompt weighting for example. And also to be able to have an empty value as one of the array elements. Not sure what the proper way of contributing this would be, I’m not up to speed on the workflow of PRs on public GitHub repos. |
@andynormancx you can make a PR to https://github.com/flanneryhbh/Fooocus-add-array-to-propt/tree/main so your changes will be reflected in this PR if @flanneryhbh accepts them. |
@Ev-Bro this feature is still in a Pull Request, meaning it's not in the current base version of Fooocus. If you are having trouble getting it to work in my forked branch, please elaborate. |
My bad! Please ignore. |
@flanneryhbh This feature is merged on the other branch version and adds the ability to group words with wildcards,thanks! https://github.com/metercai/SimpleSDXL |
Idea to use arrays in the main prompt.
To use arrays, put all values inside double brackets. For example:
[[tall, short, fat, thin]] man.
would produce 4 images (tall man, short man, fat man, thin man). You also need to set your number of images to map, if you set the number of images higher, the array will just wrap around.
You can also use multiple arrays for example:
[[beautiful, ugly]] [[man, woman]] wearing a [[red, white, blue]] suit
would produce all combinations of each array (you'd need to set the image count to 12).
This can be used in conjunction with the "Freeze Seed" checkbox, so each image uses the same random seed so your images will look very similar except for the differences that come from the words in the array.