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

Escape prompt prefix/suffix along with prompt #2151

Merged
merged 1 commit into from
Jul 9, 2023

Conversation

pnb
Copy link
Contributor

@pnb pnb commented Jul 9, 2023

I've been using some models that are a bit picky about the prompt format during chats. In particular, it seems like some of them prefer a newline after the reverse prompt (e.g., ASSISTANT:\n). The existing "main" example does allow parsing newlines and other escape characters in the prompt with -e, but not in the prompt prefix or suffix (--in-prefix and --in-suffix). This pull request adds escaping to those parts as well, allowing for things like this:

./main -m some-model.bin -f ./prompts/some-prompt.txt -i -e --reverse-prompt 'USER:' --in-prefix ' ' --in-suffix 'ASSISTANT:\n'

This inserts "ASSISTANT:" and a newline after the user presses enter, which works a bit better in some of my cases. I haven't needed escape characters in the prompt prefix, but it seems better to parse them anyway for consistency. Possibly there are use cases where it would be needed that I haven't encountered.

@ggerganov ggerganov merged commit db4047a into ggerganov:master Jul 9, 2023
@wtarreau
Copy link
Contributor

Ah, nice, thanks for this one, I've been annoyed several times as well.

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