You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Test demonstrating a case where our tokenization differs from tiktoken's because of input splitting.
70
+
#[test]
71
+
fnsplitting_difference(){
72
+
let text = "\"}\n Sn_ang personalities-vis579 jungeilmington CONTRgenerator aplik toxinsindividual\tmemset Bahrain\"'; Griffify\t\t\t Universbarcode Gall ОбfindViewByIdjan stor harga üuffers SupportYROparticle";
73
+
let input = text.as_bytes();
74
+
let expected:Vec<_> = cl100k_base_singleton()
75
+
.lock()
76
+
.encode_ordinary(text)
77
+
.into_iter()
78
+
.map(|i| i asu32)
79
+
.collect();
80
+
81
+
let without_splitting = BPE_CL100K.encode_via_backtracking(input);
82
+
assert_ne!(without_splitting, expected);
83
+
84
+
let pat = "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}{1,3}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+";
0 commit comments