-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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 --in-prefix-bos
to prefix BOS to user inputs; keep EOS
#2304
Conversation
The BOS precedes the string specified by `--in-prefix`. Model generated EOS is now kept in the context. It provides a way to strictly following the prompt format used in Llama-2-chat. The EOS handling also benefits some existing finetunes that uses EOS to mark the end of turn.
For llama-2-chat, you want $ ./main -m "$MODEL" -c 4096 -n -1 \
--in-prefix-bos --in-prefix ' [INST] ' --in-suffix ' [/INST]' -i -p \
"[INST] <<SYS>>
$SYSTEM
<</SYS>>
$instruct [/INST]" The spaces in in-prefix/suffix are important. |
Currently prompt already has an implicit BOS right? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change seems good, but maybe do some more testing by more people to be sure we didn't mess up the main loop somehow
@JackJollimore you're missing the backslashes |
Unfortunately it doesn't work for me either. It starts asking itself questions and then answers them. |
I overlooked the quotation after converting to .txt. Thanks for pointing that out, but I copy/pasted, so if there's new lines then the shell did that. Termux ignored commands after backslash, and I deleted them to make it work. I don't have a clear understanding of this PR, so maybe someone skilled will test. |
Just following up that it works for me now, I made a few user errors and also ran into the copy + paste problem. It's all solved now. 👍 |
Another 👍, working well for me as well on |
Works for me as well! I have rewritten a small bash script that is copy/pastable: #!/bin/bash
# The script should be launched like ./chat.sh models/llama-2-13b-chat.ggmlv3.q4_0.bin system_prompts/translation.txt Hello
# Load system prompt
SYSTEM_PROMPT=$(cat $2)
# Execute model
./main -m $1 -c 4096 -n -1 --in-prefix-bos --in-prefix ' [INST] ' --in-suffix ' [/INST]' -i \
-p "[INST] <<SYS>>\n$SYSTEM_PROMPT\n<</SYS>>\n\n$3 [/INST]" with the following content for Translate every sentence from English into French. |
@lionelchg Would be a nice contribution to |
This is great! FYI as an additional benefit, this unblocks using
|
Builds on top of PR ggerganov#2304 to create a working script for system prompt integration with interactive mode.
Builds on top of PR ggerganov#2304 to create a working script for system prompt integration with interactive mode.
Yes, I couldn't get one of my older models (wizardlm) working with the latest llama.cpp |
Sorry for breaking people's command line with reverse prompt. Previously if you specified reverse prompt, and the model generated an EOS, the EOS is replaced by a new line and the first reverse prompt was inserted. That was a bit unintuitive and overlapped with in-prefix. Now with this PR, if the model generates EOS, the EOS is kept in the context, and NO reverse prompt would be inserted automatically. In order to have some text prefix your input, use
after this PR, you only need
which is because Vicuna is capable of generating EOS. In fact, the latter worked before this PR too. Same things for Wizarldlm or other model that uses EOS to signal the end of generation. |
…ep EOS (ggerganov#2304)" This reverts commit 0c06204.
Reference: ggerganov/llama.cpp#2304 :)
The BOS precedes the string specified by
--in-prefix
. Model generated EOS is now kept in the context.It provides a way to strictly following the prompt format used in Llama-2-chat.
The EOS handling also benefits some existing finetunes that uses EOS to mark the end of turn.