Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/bpe/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl MergeState<'_, '_> {
}

#[inline]
pub fn iter(&self) -> Iter {
pub fn iter(&self) -> Iter<'_> {
Iter {
bpe: self.bpe,
marks: &self.marks,
Expand Down
4 changes: 2 additions & 2 deletions src/bpe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl Bpe {
"gpt2" => {
let pre_type = gguf.get_str("tokenizer.ggml.pre").unwrap();
let regex_str = match pre_type {
"qwen2" | "deepseek-r1-qwen" => TOKENIZER_PRE_QWEN,
"qwen2" | "deepseek-r1-qwen" | "olmo" => TOKENIZER_PRE_QWEN,
_ => unimplemented!("not supported pre_type {}", pre_type),
};
match scores {
Expand Down Expand Up @@ -337,7 +337,7 @@ impl Method for Bpe {
vocab.into_iter()
}

fn decode(&self, token: utok, buf: &mut TextBuf) -> Cow<[u8]> {
fn decode(&self, token: utok, buf: &mut TextBuf) -> Cow<'_, [u8]> {
match &self.modeltype {
Model::GPT2(_) => {
if self.special.contains(&token) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub trait Method {
fn vocab_size(&self) -> usize;
fn internal_special(&self) -> impl IntoIterator<Item = (&str, utok)>;
fn encode(&self, text: &str) -> impl IntoIterator<Item = utok> + '_;
fn decode(&self, token: utok, buf: &mut TextBuf) -> Cow<[u8]>;
fn decode(&self, token: utok, buf: &mut TextBuf) -> Cow<'_, [u8]>;
fn pre_encode<'s>(&self, text: &'s str) -> Cow<'s, str> {
text.into()
}
Expand Down
2 changes: 1 addition & 1 deletion src/lpe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl Method for Lpe {
tokens
}
#[inline]
fn decode(&self, token: utok, _buf: &mut TextBuf) -> Cow<[u8]> {
fn decode(&self, token: utok, _buf: &mut TextBuf) -> Cow<'_, [u8]> {
self.token(token).into()
}
}
Expand Down