Skip to content

Commit

Permalink
cleanup and remove HashMap#clone missed in #12
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Oct 17, 2024
1 parent 7ba8ad9 commit 4c40c49
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/corebpe.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use fancy_regex::Regex;
use rustc_hash::FxHashMap as HashMap;
use rustc_hash::FxHashSet as HashSet;
use std::sync::Arc;
use thread_local::ThreadLocal;

pub type Rank = u32;
Expand Down
7 changes: 3 additions & 4 deletions src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::corebpe::CoreBPE;
use regex::Regex;
use rustc_hash::FxHashMap as HashMap;
use rustc_hash::FxHashSet as HashSet;
use std::sync::Arc;
use thiserror::Error;
use odht::HashTableOwned;
use crate::rollhash::{roll_hash, roll_hash_slice};
Expand All @@ -27,7 +26,7 @@ pub struct Encoding {
/// The maximum token value in the encoding.
max_token_value: Rank,
/// The core BPE logic implemented in Rust.
core_bpe: Arc<CoreBPE>,
core_bpe: CoreBPE,
}

// TODO: make a non-generic encoding error here
Expand Down Expand Up @@ -96,7 +95,7 @@ impl Encoding {
.ok_or_else(|| EncodingError::GenericEncodingError("No mergeable ranks found".to_string()))?;

let core_bpe = CoreBPE::new(
mergeable_ranks.clone(),
mergeable_ranks,
special_tokens.clone(),
pat_str,
)
Expand All @@ -122,7 +121,7 @@ impl Encoding {
prefixes_of_mergeable_ranks,
special_tokens,
max_token_value,
core_bpe: Arc::new(core_bpe),
core_bpe: core_bpe,
})
}

Expand Down

0 comments on commit 4c40c49

Please sign in to comment.