Skip to content

Conversation

LaffeyNyaa
Copy link
Contributor

@LaffeyNyaa LaffeyNyaa commented Aug 23, 2025

When compiling with MSVC in the Debug configuration, during the execution of the llama_chat_apply_template function, the trim function (located in src/llama-chat.cpp) is called for certain models (e.g., Gemma 3). If non-ASCII characters are present in the const struct llama_chat_message * chat passed to the llama_chat_apply_template function, the assertion within the isspace function in the trim function will trigger an Assertion Failed error. The error message displays the expression: c >= -1 && c <= 255.

To resolve this problem, I added static_cast<unsigned char> to the isspace call, ensuring that negative-valued non-ASCII characters are converted to positive values.

@CISC CISC merged commit 21dc4dd into ggml-org:master Aug 23, 2025
48 checks passed
qnixsynapse pushed a commit to menloresearch/llama.cpp that referenced this pull request Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants