diff options
author | goerch <jhr.walter@t-online.de> | 2023-09-16 13:41:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-16 13:41:33 +0200 |
commit | b08e75baea294e366628b898e85c0bd359b58115 (patch) | |
tree | 417a1a8e7589567ceedba88771056aee080c8e70 /common/common.cpp | |
parent | e6616cf0db2b63189fc34d0076f654af9adecdf8 (diff) |
Fixing the last deviations from sentencepiece indicated by test-tokenizer-1 (#3170)
* Fix für #2721
* Reenable tokenizer test for LLaMa
* Add `console.cpp` dependency
* Fix dependency to `common`
* Fixing wrong fix.
* Make console usage platform specific
Work on compiler warnings.
* Adapting makefile
* Remove trailing whitespace
* Adapting the other parts of the makefile
* Fix typo.
* Fixing the last deviations from sentencepiece indicated by test-tokenizer-1
* Simplify logic
* Add missing change...
* Fix ugly compiler warning
* llama_tokenize should accept strings containing NUL now
* Adding huichen's test case
Diffstat (limited to 'common/common.cpp')
-rw-r--r-- | common/common.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/common.cpp b/common/common.cpp index 02ec0f8d..6d655fd5 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -801,10 +801,10 @@ std::vector<llama_token> llama_tokenize( // upper limit for the number of tokens int n_tokens = text.length() + add_bos; std::vector<llama_token> result(n_tokens); - n_tokens = llama_tokenize(ctx, text.c_str(), result.data(), result.size(), add_bos); + n_tokens = llama_tokenize(ctx, text.data(), text.length(), result.data(), result.size(), add_bos); if (n_tokens < 0) { result.resize(-n_tokens); - int check = llama_tokenize(ctx, text.c_str(), result.data(), result.size(), add_bos); + int check = llama_tokenize(ctx, text.data(), text.length(), result.data(), result.size(), add_bos); GGML_ASSERT(check == -n_tokens); } else { result.resize(n_tokens); |