Skip to content

Commit 49e8a7d

Browse files
committed
rename
1 parent f8e8366 commit 49e8a7d

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

lib/llm/benches/tokenizer_dataset.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn print_summary(
144144
println!(" Total tokens: {total_tokens}");
145145
println!(" ---");
146146
println!(" HF total: {hf_ms:>10.2} ms");
147-
println!(" fasttokens total: {ft_ms:>10.2} ms");
147+
println!(" fastokens total: {ft_ms:>10.2} ms");
148148
println!(" Speedup: {speedup:>10.2}x");
149149
println!(" ---");
150150
println!(" HF avg/sample: {:>10.3} ms", hf_ms / nf);
@@ -170,7 +170,7 @@ fn bench_sequential(samples: &[String], hf: &HuggingFaceTokenizer, fast: &FastTo
170170
let t0 = Instant::now();
171171
let hf_enc = hf.encode(text).expect("HF encode failed");
172172
let t1 = Instant::now();
173-
let ft_enc = fast.encode(text).expect("fasttokens encode failed");
173+
let ft_enc = fast.encode(text).expect("fastokens encode failed");
174174
let t2 = Instant::now();
175175

176176
let dt_hf = t1 - t0;
@@ -238,7 +238,7 @@ fn bench_batched(
238238
let t1 = Instant::now();
239239
let ft_results = fast
240240
.encode_batch(&batch_refs)
241-
.expect("fasttokens encode_batch failed");
241+
.expect("fastokens encode_batch failed");
242242
let t2 = Instant::now();
243243

244244
// Verify correctness per sample within the batch
@@ -303,7 +303,7 @@ fn main() {
303303
let hf = HuggingFaceTokenizer::from_file(&tokenizer_path)
304304
.expect("Failed to load HuggingFace tokenizer");
305305
let fast =
306-
FastTokenizer::from_file(&tokenizer_path).expect("Failed to load fasttokens tokenizer");
306+
FastTokenizer::from_file(&tokenizer_path).expect("Failed to load fastokens tokenizer");
307307

308308
// Warmup
309309
if let Some(s) = samples.first() {

lib/llm/benches/tokenizer_simple.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ pub fn tiktoken_decode(c: &mut Criterion) {
144144
//
145145
// By default these use the in-tree TinyLlama tokenizer. Override with a
146146
// production-size tokenizer for more realistic numbers:
147-
// TOKENIZER_PATH=/path/to/tokenizer.json cargo bench -- fasttokens
148-
// TOKENIZER_PATH=Qwen/Qwen3-0.6B cargo bench -- fasttokens
147+
// TOKENIZER_PATH=/path/to/tokenizer.json cargo bench -- fastokens
148+
// TOKENIZER_PATH=Qwen/Qwen3-0.6B cargo bench -- fastokens
149149
// ---------------------------------------------------------------------------
150150

151151
/// Default HuggingFace model to download when TOKENIZER_PATH is not set.
152152
const DEFAULT_HF_MODEL: &str = "Qwen/Qwen3-0.6B";
153153

154154
/// Resolve a tokenizer.json path from TOKENIZER_PATH env var or download from HF Hub.
155-
fn resolve_fasttokens_path() -> String {
155+
fn resolve_tokenizer_path() -> String {
156156
let input = std::env::var("TOKENIZER_PATH").ok();
157157

158158
if let Some(ref p) = input
@@ -175,10 +175,10 @@ fn resolve_fasttokens_path() -> String {
175175
.to_string()
176176
}
177177

178-
const FASTTOKENS_BATCH_SIZE: usize = 64;
178+
const FASTOKENS_BATCH_SIZE: usize = 64;
179179

180-
pub fn fasttokens_encode(c: &mut Criterion) {
181-
let tokenizer_path = resolve_fasttokens_path();
180+
pub fn fastokens_encode(c: &mut Criterion) {
181+
let tokenizer_path = resolve_tokenizer_path();
182182
let test_str: &str = &INPUT_STR.repeat(TARGET_ISL / INPUT_STR.len());
183183

184184
let hf_encoder = HuggingFaceTokenizer::from_file(&tokenizer_path).unwrap();
@@ -190,10 +190,10 @@ pub fn fasttokens_encode(c: &mut Criterion) {
190190
assert_eq!(
191191
hf_ids.token_ids(),
192192
fast_ids.token_ids(),
193-
"fasttokens and HuggingFace must produce identical token IDs"
193+
"fastokens and HuggingFace must produce identical token IDs"
194194
);
195195

196-
let mut group = c.benchmark_group("fasttokens-encode");
196+
let mut group = c.benchmark_group("fastokens-encode");
197197
group.throughput(Throughput::Bytes(test_str.len() as u64));
198198

199199
group.bench_function("hf_encode", |b| {
@@ -202,7 +202,7 @@ pub fn fasttokens_encode(c: &mut Criterion) {
202202
})
203203
});
204204

205-
group.bench_function("fasttokens_encode", |b| {
205+
group.bench_function("fastokens_encode", |b| {
206206
b.iter(|| {
207207
let _ = fast_encoder.encode(black_box(test_str)).unwrap();
208208
})
@@ -211,15 +211,15 @@ pub fn fasttokens_encode(c: &mut Criterion) {
211211
group.finish();
212212
}
213213

214-
pub fn fasttokens_batch_encode(c: &mut Criterion) {
215-
let tokenizer_path = resolve_fasttokens_path();
216-
let batch: Vec<&str> = (0..FASTTOKENS_BATCH_SIZE).map(|_| INPUT_STR).collect();
214+
pub fn fastokens_batch_encode(c: &mut Criterion) {
215+
let tokenizer_path = resolve_tokenizer_path();
216+
let batch: Vec<&str> = (0..FASTOKENS_BATCH_SIZE).map(|_| INPUT_STR).collect();
217217
let total_bytes: u64 = batch.iter().map(|s| s.len() as u64).sum();
218218

219219
let hf_encoder = HuggingFaceTokenizer::from_file(&tokenizer_path).unwrap();
220220
let fast_encoder = FastTokenizer::from_file(&tokenizer_path).unwrap();
221221

222-
let mut group = c.benchmark_group("fasttokens-batch-encode");
222+
let mut group = c.benchmark_group("fastokens-batch-encode");
223223
group.throughput(Throughput::Bytes(total_bytes));
224224

225225
group.bench_function("hf_batch_encode", |b| {
@@ -228,7 +228,7 @@ pub fn fasttokens_batch_encode(c: &mut Criterion) {
228228
})
229229
});
230230

231-
group.bench_function("fasttokens_batch_encode", |b| {
231+
group.bench_function("fastokens_batch_encode", |b| {
232232
b.iter(|| {
233233
let _ = fast_encoder.encode_batch(black_box(&batch)).unwrap();
234234
})
@@ -244,7 +244,7 @@ criterion_group!(
244244
decode_big,
245245
tiktoken_encode,
246246
tiktoken_decode,
247-
fasttokens_encode,
248-
fasttokens_batch_encode
247+
fastokens_encode,
248+
fastokens_batch_encode
249249
);
250250
criterion_main!(benches);

0 commit comments

Comments
 (0)