Skip to content

Commit 2112a0e

Browse files
authored
Merge pull request #15 from github/aneubeck/dict
Make encoders clonable
2 parents 9feb662 + f766236 commit 2112a0e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

crates/bpe/src/appendable_encoder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use crate::byte_pair_encoding::BytePairEncoding;
22

3+
#[derive(Clone)]
34
struct State {
45
state: u32,
56
last_token: u32,
67
count: u32,
78
}
89

910
/// Encoder which keeps track of the encoding length while appending characters.
11+
#[derive(Clone)]
1012
pub struct AppendableEncoder<'a> {
1113
bpe: &'a BytePairEncoding,
1214
states: Vec<State>,

crates/bpe/src/prependable_encoder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use crate::byte_pair_encoding::BytePairEncoding;
22

3+
#[derive(Clone)]
34
struct State {
45
state: u32,
56
prev_token: u32,
67
count: u32,
78
}
89

910
/// Encoder which keeps track of the encoding length while prepending characters.
11+
#[derive(Clone)]
1012
pub struct PrependableEncoder<'a> {
1113
bpe: &'a BytePairEncoding,
1214
states: Vec<State>,

0 commit comments

Comments
 (0)