]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
unicode,test: add Qwen3.5 non-backtracking tokenizer handler and regr… (#22110)
authorKabir Potdar <redacted>
Thu, 14 May 2026 09:03:40 +0000 (09:03 +0000)
committerGitHub <redacted>
Thu, 14 May 2026 09:03:40 +0000 (11:03 +0200)
commit42532afff43910e619a650c1704525b3acbbec5a
tree62175794c09a0d1707be9a0a087af07561042360
parentdbe7901ca652cc8fe314e6972e3ce9cb33edf33d
unicode,test: add Qwen3.5 non-backtracking tokenizer handler and regr… (#22110)

* unicode,test: add Qwen3.5 non-backtracking tokenizer handler and regression tests

- Add unicode_regex_split_custom_qwen35() to [src/unicode.cpp](src/unicode.cpp), a non-backtracking handler for Qwen3.5's [\p{L}\p{M}]+ regex (letters + combining marks).
- Register the handler in the custom tokenizer dispatch table to prevent stack overflows on long inputs (fixes #21919).
- Add [models/ggml-vocab-qwen35.gguf](models/ggml-vocab-qwen35.gguf) (test vocab), [models/ggml-vocab-qwen35.gguf.inp](models/ggml-vocab-qwen35.gguf.inp) (test cases), and [models/ggml-vocab-qwen35.gguf.out](models/ggml-vocab-qwen35.gguf.out) (expected output) for regression testing.
- Update [tests/CMakeLists.txt](tests/CMakeLists.txt) to include the new test entry.

This mirrors the Qwen2 fix (commit 0d049d6), but adapts for Qwen3.5's regex. Ensures robust Unicode tokenization and prevents std::regex stack overflows.

Closes #21919.

* fix: enhance regex handling for Qwen3.5 tokenizer to include accent marks

* cont : remove trailing whitespace

---------

Co-authored-by: Kabir <redacted>
Co-authored-by: Alde Rojas <redacted>
models/ggml-vocab-qwen35.gguf [new file with mode: 0644]
models/ggml-vocab-qwen35.gguf.inp [new file with mode: 0644]
models/ggml-vocab-qwen35.gguf.out [new file with mode: 0644]
src/unicode.cpp
tests/CMakeLists.txt