fix regressions in system prompt handling (#2219)

* python: fix system prompt being ignored
* fix unintended whitespace after system prompt

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
Jared Van Bortel
2024-04-15 11:39:48 -04:00
committed by GitHub
parent 2273cf145e
commit ac498f79ac
4 changed files with 12 additions and 19 deletions

View File

@@ -755,6 +755,7 @@ void LLamaModel::embedInternal(
tokens.resize(text.length()+4);
int32_t n_tokens = llama_tokenize(d_ptr->model, text.c_str(), text.length(), tokens.data(), tokens.size(), wantBOS, false);
if (n_tokens) {
(void)eos_token;
assert(useEOS == (eos_token != -1 && tokens[n_tokens - 1] == eos_token));
tokens.resize(n_tokens - useEOS); // erase EOS/SEP
} else {