@@ -17,6 +17,8 @@ static std::string unescape_whitespace(llama_context* ctx, const std::vector<lla
17
17
static const std::map<std::string, std::vector<llama_token>> & k_tests () {
18
18
static std::map<std::string, std::vector<llama_token>> _k_tests = {
19
19
{ " " , {1 , 259 , }, },
20
+ { " " , { 1 , 1678 , }, },
21
+ { " " , { 1 , 268 , }, },
20
22
{ " \t " , { 1 , 29871 , 12 , }, },
21
23
{ " \n " , { 1 , 29871 , 13 , }, },
22
24
{ " \t\n " , { 1 , 29871 , 12 , 13 , }, },
@@ -38,6 +40,12 @@ static const std::map<std::string, std::vector<llama_token>> & k_tests() {
38
40
243 , 162 , 155 , 185 , 30722 , 243 , 162 , 143 , 174 , 30598 ,
39
41
313 , 20787 , 953 , 3848 , 275 , 16125 , 630 , 29897 , 29871 , 31681 ,
40
42
313 , 6194 , 953 , 29877 , 2397 , 393 , 756 , 967 , 1914 , 5993 , 29897 , }, },
43
+ { " Hello" , { 1 , 15043 }, },
44
+ { " Hello" , { 1 , 29871 , 15043 }, },
45
+ { " Hello" , { 1 , 259 , 15043 }, },
46
+ { " Hello" , { 1 , 1678 , 15043 }, },
47
+ { " Hello" , { 1 , 268 , 15043 }, },
48
+ { " Hello\n Hello" , { 1 , 268 , 15043 , 13 , 1678 , 15043 }, },
41
49
};
42
50
43
51
return _k_tests;
@@ -106,7 +114,8 @@ int main(int argc, char **argv) {
106
114
107
115
if (!correct) {
108
116
fprintf (stderr, " %s : failed test: '%s'\n " , __func__, test_kv.first .c_str ());
109
- fprintf (stderr, " %s : detokenized to: '%s'\n " , __func__, unescape_whitespace (ctx, test_kv.second ).c_str ());
117
+ fprintf (stderr, " %s : detokenized to: '%s' instead of '%s'\n " , __func__,
118
+ unescape_whitespace (ctx, res).c_str (), unescape_whitespace (ctx, test_kv.second ).c_str ());
110
119
fprintf (stderr, " %s : expected tokens: " , __func__);
111
120
for (const auto & t : test_kv.second ) {
112
121
fprintf (stderr, " %6d, " , t);
0 commit comments