Skip to content
Draft
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
6 changes: 3 additions & 3 deletions tokenizers/src/models/bpe/trainer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ impl BpeTrainer {
words: &[Word],
counts: &[u64],
p: &Option<ProgressBar>,
) -> (AHashMap<Pair, i32>, AHashMap<Pair, AHashSet<usize>>) {
) -> (AHashMap<Pair, i64>, AHashMap<Pair, AHashSet<usize>>) {
words
.maybe_par_iter()
.enumerate()
Expand All @@ -429,7 +429,7 @@ impl BpeTrainer {

// Initialize pair_counts and where_to_update for this pair if we just saw it
// Then update counts
*pair_counts.entry(cur_pair).or_default() += counts[i] as i32;
*pair_counts.entry(cur_pair).or_default() += counts[i] as i64;
where_to_update.entry(cur_pair).or_default().insert(i);
}

Expand Down Expand Up @@ -581,7 +581,7 @@ impl BpeTrainer {

// Introduce new formed pairs
for ((pair, change), iw) in changes {
let count = change * counts[iw] as i32;
let count = change as i64 * counts[iw] as i64;
*pair_counts.entry(pair).or_default() += count;
if change > 0 {
where_to_update.entry(pair).or_default().insert(iw);
Expand Down