summaryrefslogtreecommitdiff
path: root/common/common.h
diff options
context:
space:
mode:
authorstaviq <staviq@gmail.com>2023-10-17 17:11:01 +0200
committerGitHub <noreply@github.com>2023-10-17 18:11:01 +0300
commit1a159553f921a9209fed8c714494e57b3649f232 (patch)
treeb880614b6be6541d1890db725a7292fccef93855 /common/common.h
parent281ef73c258cc1eebec8a64264240432d5878c4b (diff)
tokenizer : special token handling (#3538)
* Rewrite special token handling from #1931 * shorten param name, add st verification by type * use offsets instead of copy by substr * formatting, remove copying iterator on delete * llama : normalize code-style * swift fix * print pfx/sfx if verb, main: split pfx input sfx * dont add space when using special tokens * minor : comment + spacing --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Diffstat (limited to 'common/common.h')
-rw-r--r--common/common.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/common.h b/common/common.h
index 36fd4416..08c60323 100644
--- a/common/common.h
+++ b/common/common.h
@@ -137,12 +137,14 @@ struct llama_context_params llama_context_params_from_gpt_params(const gpt_param
std::vector<llama_token> llama_tokenize(
const struct llama_context * ctx,
const std::string & text,
- bool add_bos);
+ bool add_bos,
+ bool special = false);
std::vector<llama_token> llama_tokenize(
const struct llama_model * model,
const std::string & text,
- bool add_bos);
+ bool add_bos,
+ bool special = false);
// tokenizes a token into a piece
// should work similar to Python's `tokenizer.id_to_piece`