Skip to content

Commit

Permalink
Remove needless unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
sftse committed Dec 28, 2024
1 parent b5cbaba commit 4ab3f84
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tokenizers/src/models/bpe/trainer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,10 @@ impl BpeTrainer {
break;
}

if queue.is_empty() {
let Some(mut top) = queue.pop() else {
break;
}
};

let mut top = queue.pop().unwrap();
if top.count != pair_counts[&top.pair] as u64 {
top.count = pair_counts[&top.pair] as u64;
queue.push(top);
Expand Down

0 comments on commit 4ab3f84

Please sign in to comment.