Skip to content

Commit

Permalink
Replace once_cell with standard library
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikvanantwerpen committed Sep 27, 2024
1 parent 16081c0 commit 0c2ec6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion crates/bpe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ tiktoken-rs = ["dep:tiktoken-rs"]
aneubeck-daachorse = "1.1.1"
fnv = "1.0"
itertools = "0.12"
once_cell = "1"
rand = { version = "0.8", optional = true }
rmp-serde = "1"
serde = { version = "1", features = ["derive"] }
Expand Down
6 changes: 3 additions & 3 deletions crates/bpe/src/byte_pair_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::hash::{Hash, Hasher};
use std::ops::Range;
use std::sync::LazyLock;

use aneubeck_daachorse::{DoubleArrayAhoCorasick, DoubleArrayAhoCorasickBuilder};
use fnv::{FnvHashMap, FnvHasher};
use itertools::Itertools;
use once_cell::sync::Lazy;
use serde::de::Visitor;
use serde::{Deserialize, Deserializer, Serialize, Serializer};

use crate::backtrack_encoder::BacktrackEncoder;
use crate::bitfield::BitField;

static BPE_CL100K: Lazy<BytePairEncoding> = Lazy::new(|| {
static BPE_CL100K: LazyLock<BytePairEncoding> = LazyLock::new(|| {
let bytes = include_bytes!("data/bpe_cl100k.dict");
rmp_serde::from_slice(bytes).expect("")
});

static BPE_O200K: Lazy<BytePairEncoding> = Lazy::new(|| {
static BPE_O200K: LazyLock<BytePairEncoding> = LazyLock::new(|| {
let bytes = include_bytes!("data/bpe_o200k.dict");
rmp_serde::from_slice(bytes).expect("")
});
Expand Down

0 comments on commit 0c2ec6c

Please sign in to comment.