Skip to content

Commit 6899c7c

Browse files
committed
Expose seperator token
The seperator token is required in bert style rerankers, normally cls token is also required for rerankers but is currently deprecated in llama.cpp (as it is the same as the bos token for a model), and thus not necesary.
1 parent a6565b0 commit 6899c7c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llama-cpp-2/src/model.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ impl LlamaModel {
185185
LlamaToken(token)
186186
}
187187

188+
/// Get the separator token (SEP).
189+
#[must_use]
190+
pub fn token_sep(&self) -> LlamaToken {
191+
let token = unsafe { llama_cpp_sys_2::llama_vocab_sep(self.vocab_ptr()) };
192+
LlamaToken(token)
193+
}
194+
188195
/// Convert single token to a string.
189196
///
190197
/// # Errors

0 commit comments

Comments
 (0)