tokenize first reverse prompt once
This commit is contained in:
parent
e33df8e1a0
commit
52f46ef78a
1 changed files with 4 additions and 2 deletions
6
main.cpp
6
main.cpp
|
@ -885,6 +885,9 @@ int main(int argc, char ** argv) {
|
||||||
antipromptv_inp.push_back(::llama_tokenize(vocab, antiprompt, false));
|
antipromptv_inp.push_back(::llama_tokenize(vocab, antiprompt, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tokenize the first reverse prompt
|
||||||
|
std::vector<llama_vocab::id> first_antiprompt = ::llama_tokenize(vocab, params.antiprompt.front(), false);
|
||||||
|
|
||||||
// enable interactive mode if reverse prompt is specified
|
// enable interactive mode if reverse prompt is specified
|
||||||
if (antipromptv_inp.size() != 0) {
|
if (antipromptv_inp.size() != 0) {
|
||||||
params.interactive = true;
|
params.interactive = true;
|
||||||
|
@ -1005,8 +1008,7 @@ int main(int argc, char ** argv) {
|
||||||
if (id == EOS_TOKEN_ID && params.interactive) {
|
if (id == EOS_TOKEN_ID && params.interactive) {
|
||||||
id = NEWLINE_TOKEN_ID;
|
id = NEWLINE_TOKEN_ID;
|
||||||
if (params.antiprompt.size() != 0) {
|
if (params.antiprompt.size() != 0) {
|
||||||
// tokenize the first reverse prompt and inject on the newline
|
// inject first reverse prompt
|
||||||
std::vector<llama_vocab::id> first_antiprompt = ::llama_tokenize(vocab, params.antiprompt.front(), false);
|
|
||||||
embd_inp.insert(embd_inp.end(), first_antiprompt.begin(), first_antiprompt.end());
|
embd_inp.insert(embd_inp.end(), first_antiprompt.begin(), first_antiprompt.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue