-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
Description
Name and Version
The latest b4491 version with llama.android example
Operating systems
Other? (Please let us know in description)
Which llama.cpp modules do you know to be affected?
Other (Please specify in the next section)
Command line
No response
Problem description & steps to reproduce
- Run
llama.androidexample - Loaded with SmolLM2 model
- Send with chat template (User message:
Tell a joke), the template are generated by thecommon_chat_apply_template()method
Code location: llama.cpp/examples/llama.android/app/src/main/java/com/example/llama/MainViewModel.kt
val smollm2msg = "<|im_start|>system\n" +
"You are a helpful AI assistant<|im_end|>\n" +
"<|im_start|>user\n" +
"$text<|im_end|>\n" +
"<|im_start|>assistant\n"
viewModelScope.launch {
llamaAndroid.send(smollm2msg)
.catch {
Log.e(tag, "send() failed", it)
messages += it.message!!
}
.collect { messages = messages.dropLast(1) + (messages.last() + it) }
}- Issue reproduce, the model keeps replying and cannot be stopped normally until it exceeds the context, and it will contain tokens such as
<|im_start|>and<|im_end|>
Comparison test:
This problem cannot be reproduced using the command line program llama-cli with the same LLM model
./llama-cli -m models/smollm2-360m-instruct-q8_0.gguf -p "You are a helpful assistant" -cnv
First Bad Commit
Since the establishment of llama.android
Relevant log output
No response
