Skip to content

Commit f5972a1

Browse files
committed
vocab : return error instead of aborting on oversized token count
1 parent cdb6fb5 commit f5972a1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/llama-vocab.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3061,7 +3061,8 @@ int32_t llama_vocab::tokenize(
30613061
bool parse_special) const {
30623062
auto res = tokenize(std::string(text, text_len), add_special, parse_special);
30633063
if (res.size() >= static_cast<size_t>(std::numeric_limits<int32_t>::max())) {
3064-
GGML_ABORT("tokenization result size %zu exceeds int32_t limit", res.size());
3064+
LLAMA_LOG_ERROR("%s: tokenization result size %zu exceeds int32_t limit\n", __func__, res.size());
3065+
return -1;
30653066
}
30663067

30673068
if (n_tokens_max < (int) res.size()) {

0 commit comments

Comments
 (0)