File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 1
1
use fancy_regex:: Regex ;
2
2
use rustc_hash:: FxHashMap as HashMap ;
3
3
use rustc_hash:: FxHashSet as HashSet ;
4
- use std:: sync:: Arc ;
5
4
use thread_local:: ThreadLocal ;
6
5
7
6
pub type Rank = u32 ;
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ use crate::corebpe::CoreBPE;
2
2
use regex:: Regex ;
3
3
use rustc_hash:: FxHashMap as HashMap ;
4
4
use rustc_hash:: FxHashSet as HashSet ;
5
- use std:: sync:: Arc ;
6
5
use thiserror:: Error ;
7
6
use odht:: HashTableOwned ;
8
7
use crate :: rollhash:: { roll_hash, roll_hash_slice} ;
@@ -27,7 +26,7 @@ pub struct Encoding {
27
26
/// The maximum token value in the encoding.
28
27
max_token_value : Rank ,
29
28
/// The core BPE logic implemented in Rust.
30
- core_bpe : Arc < CoreBPE > ,
29
+ core_bpe : CoreBPE ,
31
30
}
32
31
33
32
// TODO: make a non-generic encoding error here
@@ -96,7 +95,7 @@ impl Encoding {
96
95
. ok_or_else ( || EncodingError :: GenericEncodingError ( "No mergeable ranks found" . to_string ( ) ) ) ?;
97
96
98
97
let core_bpe = CoreBPE :: new (
99
- mergeable_ranks. clone ( ) ,
98
+ mergeable_ranks,
100
99
special_tokens. clone ( ) ,
101
100
pat_str,
102
101
)
@@ -122,7 +121,7 @@ impl Encoding {
122
121
prefixes_of_mergeable_ranks,
123
122
special_tokens,
124
123
max_token_value,
125
- core_bpe : Arc :: new ( core_bpe) ,
124
+ core_bpe : core_bpe,
126
125
} )
127
126
}
128
127
You can’t perform that action at this time.
0 commit comments