K2_HORIZON pre-tokenizer regex fails on MSVC builds, \u200C unsupported by std::regex on Windows.

#3
by ZXM27 - opened

i compiled the llama fork to test the model out but i got a regex error

Failed to process regex: '(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\r\n\p{L}\p{N}]?(?:\p{L}|\p{M}|\u200C|\u200D)+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]|\s[\r\n]+|\s+(?!\S)|\s+'
Regex error: regex_error(error_escape): The expression contained an invalid escaped character, or a trailing escape.
0.01.368.298 E llama_model_load: error loading model: error loading model vocabulary: Failed to process regex

But, going into llama-vocab.cpp and replacing the string with "(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\r\n\p{L}\p{N}]?(?:\p{L}|\p{M})+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]|\s[\r\n]+|\s+(?!\S)|\s+", fixed the issue for me. IT DOES fuck up text containing zero-width joiners/non-joiners like Persian/Arabic/Indic scripts and multi-person emoji sequences, but for someone that uses models in english or spanish, for me it's no issue and it allowed the model to load without issues.

Sign up or log in to comment