mirror of
https://github.com/karpathy/nanochat.git
synced 2026-04-16 22:08:45 +00:00
rustbpe: Collapse nested if in encode()
This commit is contained in:
parent
bdd2e4e470
commit
809824a07c
|
|
@ -449,10 +449,10 @@ impl Tokenizer {
|
|||
|
||||
for i in 0..ids.len() - 1 {
|
||||
let pair: Pair = (ids[i], ids[i + 1]);
|
||||
if let Some(&new_id) = self.merges.get(&pair) {
|
||||
if best_pair.is_none() || new_id < best_pair.unwrap().2 {
|
||||
best_pair = Some((i, pair, new_id));
|
||||
}
|
||||
if let Some(&new_id) = self.merges.get(&pair)
|
||||
&& (best_pair.is_none() || new_id < best_pair.unwrap().2)
|
||||
{
|
||||
best_pair = Some((i, pair, new_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user