Modern Apps git

← Modern-Apps.git

library:ml: index the piece bytes directly, skipping a UTF-8 check

Commit
dfb26f1135b341d9ba4f668baeed0251e0676efd
Author
vayun-mathur <[email protected]>
When
2026-08-28 16:48 UTC (3 months ago)
Parents
5b6118f

Diff

library/ml/src/main/rust/src/post/sentencepiece.rs
diff --git a/library/ml/src/main/rust/src/post/sentencepiece.rs b/library/ml/src/main/rust/src/post/sentencepiece.rsindex 137e580b2d..7f07e5e715 100644--- a/library/ml/src/main/rust/src/post/sentencepiece.rs+++ b/library/ml/src/main/rust/src/post/sentencepiece.rs@@ -152,7 +152,7 @@ impl<'a> Table<'a> {             .iter()             .map(|&(from, to)| {                 self.by_piece-                    .get(prepared[from..to].as_bytes())+                    .get(&prepared.as_bytes()[from..to])                     .map_or(UNK, |&(id, _)| id)             })             .collect()