Skip to content

Commit

Permalink
minja: fix vigogne (google/minja#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ochafik committed Jan 18, 2025
1 parent e3c475c commit cc50356
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions common/minja.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,12 +1305,10 @@ struct ArgumentsExpression {
};

static std::string strip(const std::string & s) {
static std::regex trailing_spaces_regex("^\\s+|\\s+$");
return std::regex_replace(s, trailing_spaces_regex, "");
// auto start = s.find_first_not_of(" \t\n\r");
// if (start == std::string::npos) return "";
// auto end = s.find_last_not_of(" \t\n\r");
// return s.substr(start, end - start + 1);
auto start = s.find_first_not_of(" \t\n\r");
if (start == std::string::npos) return "";
auto end = s.find_last_not_of(" \t\n\r");
return s.substr(start, end - start + 1);
}

static std::string html_escape(const std::string & s) {
Expand Down
1 change: 0 additions & 1 deletion tests/test-chat-template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ int main(void) {
/* .expected_output_jinja= */ "[INST] <<SYS>>\nYou are a helpful assistant\n<</SYS>>\n\nHello [/INST] Hi there </s>[INST] Who are you [/INST] I am an assistant </s>[INST] Another question [/INST]",
/* .bos_token= */ "",
/* .eos_token= */ "</s>",
/* .supported_with_jinja= */ false, // Mysteriously fails on windows-latest in llama.cpp's CI, although that template works fine in Minja's CI on windows-latest
},
{
/* .name= */ "mlabonne/AlphaMonarch-7B",
Expand Down

0 comments on commit cc50356

Please sign in to comment.