Skip to content

Commit

Permalink
pass compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Jul 12, 2024
1 parent 3d2705f commit 8d4fae8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tokenizers/src/tokenizer/added_vocabulary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use aho_corasick::{AhoCorasick, AhoCorasickBuilder, MatchKind};
use regex::Regex;
use serde::{ser::SerializeSeq, Deserialize, Serialize, Serializer};
use std::{
collections::{HashMap, HashSet},
collections::HashMap,
sync::{Arc, Mutex},
};
/// Represent a token added by the user on top of the existing Model vocabulary.
Expand Down Expand Up @@ -301,9 +301,9 @@ impl AddedVocabulary {
}

/// Get the token matching the given id if it exists
pub fn simple_id_to_token(&self, id: &u32) -> Option<String> {
pub fn simple_id_to_token(&self, id: u32) -> Option<String> {
let added_tokens_map_r = self.added_tokens_map_r.lock().unwrap();
let token = added_tokens_map_r.get(id).map(|t| t.content.clone());
let token = added_tokens_map_r.get(&id).map(|t| t.content.clone());
token
}

Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/tokenizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ where
if !added_vocab.is_empty() {
final_vocab.reserve(added_vocab.len());
for (token, id) in added_vocab {
final_vocab.insert(token.clone(), *id);
final_vocab.insert(token.clone(), id);
}
}
}
Expand Down

0 comments on commit 8d4fae8

Please sign in to comment.