mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-22 16:25:30 +00:00
Cannot add new tokens that already exist in the vocab
This commit is contained in:
@ -471,7 +471,7 @@ impl Tokenizer {
|
||||
pub fn add_tokens(&mut self, tokens: &[AddedToken]) -> usize {
|
||||
let mut ignored = 0;
|
||||
for token in tokens {
|
||||
if token.content.is_empty() {
|
||||
if token.content.is_empty() || self.token_to_id(&token.content).is_some() {
|
||||
ignored += 1;
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user