Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion llama-cpp-2/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,11 @@ impl LlamaModel {
if attrs.is_empty()
|| attrs
.intersects(LlamaTokenAttr::Unknown | LlamaTokenAttr::Byte | LlamaTokenAttr::Unused)
// the following exclusion of control characters stems from a requirement of the original purpose of this project see
// https://github.com/utilityai/llama-cpp-rs/issues/826#issuecomment-3478624072. But it should not be the default behavior
// so this feature is now gated through the `LLAMA_RS_FORBID_CTRL_TOKEN_DECODE` environment variable
|| attrs.contains(LlamaTokenAttr::Control)
&& (token == self.token_bos() || token == self.token_eos())
&& (token == self.token_bos() || token == self.token_eos()) && std::env::var("LLAMA_RS_FORBID_CTRL_TOKEN_DECODE").is_ok_and(|v| v.parse::<bool>().is_ok_and(|v| v))
{
return Ok(Vec::new());
}
Expand Down
Loading