Skip to content

alternate prompt#1733

Merged
AUTOMATIC1111 merged 1 commit intoAUTOMATIC1111:masterfrom
macrosoft:alternate
Oct 8, 2022
Merged

alternate prompt#1733
AUTOMATIC1111 merged 1 commit intoAUTOMATIC1111:masterfrom
macrosoft:alternate

Conversation

@macrosoft
Copy link
Copy Markdown
Contributor

The ability to alternate words in the prompt.
For example: national geographic photo [parrot|owl]
Creates this prompt scheduler:
[[1, 'national geographic photo parrot'],
[2, 'national geographic photo owl'],
...
[9, 'national geographic photo parrot'],
[10, 'national geographic photo owl']]

Any number of alternating words can be used.

00000-national_geographic_photo_parrot
00001-national_geographic_photo_owl
00002-national_geographic_photo_ parrot_owl

@ClashSAN
Copy link
Copy Markdown
Collaborator

ClashSAN commented Oct 5, 2022

@macrosoft I would just like to mention a custom script that does something similar #1433

@macrosoft
Copy link
Copy Markdown
Contributor Author

@ClashSAN That custom script does something completely different.
Alternate prompt is a prompt substitution at each step of image generation. This allows you to create hybrids of animals, people or styles.
I forgot to explain the attached images. The first and second have simple prompts: "national geographic photo of parrot" and "national geographic photo of owl". The third image, with the same seed, has an alternating promt: "national geographic photo of [parrot|owl]"

@macrosoft
Copy link
Copy Markdown
Contributor Author

Yes, in fact, this is an little addition to the prompt editing feature.
Prompt editing can work together with alternate prompt.

@ClashSAN
Copy link
Copy Markdown
Collaborator

ClashSAN commented Oct 5, 2022

Looks like a great feature, and I think it getting in depends on the dev's plans for use of the | in the future.
Doing more complicated things like changing every 2 steps
photo of cow
photo of cow
photo of horse
photo of horse

or possibly including more items
photo of cow
photo of horse
photo of bird
are not possible with this I think?
This may not be added to the main repo due to it being a very specific enhancement of what prompt editing will do.
It would be awesome to have this. Maybe ported to custom script.
We'll see what happens.

@macrosoft
Copy link
Copy Markdown
Contributor Author

Prompts "photo of [cow|cow|horse|horse]" and "photo of [cow|horse|bird]" should now work.

@guumaster
Copy link
Copy Markdown

There is a guide on how to create a custom script. Could you add this a custom script instead?
Maybe even use the syntax as the other existing script, like <parrot|owl> to avoid messing with the existing use of square brackets []

The sample output you posted looks amazing, I hope I can try that!

@macrosoft
Copy link
Copy Markdown
Contributor Author

I don't know how to get access to the prompt scheduler in a custom script. The prompt scheduler is hidden very deep.

Changing the syntax is not a problem. But even now, thanks to the "|" the syntax has no ambiguity with "attention" and "prompt editing", which also use square brackets.

@Sor3nt
Copy link
Copy Markdown

Sor3nt commented Oct 6, 2022

we have something similar already

image
[girl:[cat:[girl:[cat:girl:0.1]:0.4]:0.1]:0.4]

@macrosoft
Copy link
Copy Markdown
Contributor Author

@Sor3nt Yeah, but this way is a bit more convenient.
01
[alison brie|emma stone|elizabeth olsen|scarlett johansson|anne hathaway|emma roberts], still film

@guill
Copy link
Copy Markdown

guill commented Oct 7, 2022

@Sor3nt Yeah, but this way is a bit more convenient. [alison brie|emma stone|elizabeth olsen|scarlett johansson|anne hathaway|emma roberts], still film

@macrosoft A nice workaround might be to make a custom script that simply does a text transformation from your syntax to the already-existing one that @Sor3nt showed above. That would make it easy to use, opt-in, and avoid reaching into the internals to access the schedule directly.

@macrosoft
Copy link
Copy Markdown
Contributor Author

@guill thanks for the idea.
I made a custom script. Use the Euler/Euler a sampler for good results.
https://github.com/macrosoft/stable-diffusion-webui/blob/alternate_script/scripts/alternate_prompt.py

@AUTOMATIC1111 AUTOMATIC1111 merged commit a5550f0 into AUTOMATIC1111:master Oct 8, 2022
@ClashSAN
Copy link
Copy Markdown
Collaborator

ClashSAN commented Oct 8, 2022

@macrosoft lol. I guess since it is a part of the main repo no,

@ZCaliber
Copy link
Copy Markdown

Info on this should likely be put into the Features page.

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.

7 participants