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

Prompt parser: Account for empty field in alternating words syntax #12319

Merged

Conversation

catboxanon
Copy link
Collaborator

Description

Closes #8161

Updates the prompt scheduler to allow for empty fields to be specified in the alternating words prompt syntax. This means shorthand syntax as mentioned in the issue like [fe|]male works, as opposed to typing out [female|male].

Adds two new prompt tests and all current tests pass (besides test noted # not handling this right now).

Checklist:

@AUTOMATIC1111 AUTOMATIC1111 merged commit 31a9966 into AUTOMATIC1111:dev Aug 4, 2023
3 checks passed
@rubberbaron
Copy link

Thanks for this, however, from reading the code, this looks like it wouldn't handle [|fe]male; it allows empty strings everywhere except in the first position.

@catboxanon
Copy link
Collaborator Author

Maybe I should've added a test case for it but it actually does work. Feel free to try for yourself.

@rubberbaron
Copy link

You are absolutely correct that it works, my apologies. I don't understand how it works without putting the first case inside [ ], though, but it does! I even printed out the prompt schedule to make sure it was actually parsing correctly, and it's all good.

(I do see in hindsight now that there isn't any ambiguity that complicates LALR parsing after all, so it does make sense that the fix would be straightforward.)

@w-e-w w-e-w mentioned this pull request Aug 24, 2023
@catboxanon catboxanon deleted the fix/alternating-words-empty branch March 4, 2024 23:28
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.

3 participants