Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Fix For Llava Model To Release #333

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/regex_normalization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ std::string reformat_replace_pattern(std::string replace_pattern) {

const std::map<std::string, std::string> search_pattern_rewrites = {
{R"( ([\\.\\?\\!,])| ('[ms])| (') | ('[rv]e)| (n't))", R"((?| ([\\.\\?\\!,])| ('[ms])| (') | ('[rv]e)| (n't)))"},
{R"((^)(.))", R"((^)([\s\S]))"}
{R"((^)(.))", R"((^)([\s\S]))"},
{R"((^)(.+))", R"((^)([\s\S]))"}
};

/**
Expand Down
8 changes: 8 additions & 0 deletions tests/layer_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ def test_charsmap_normalizartion(test_string, hf_charsmap_tokenizer, precompiled
replace_term=r"▁\2",
)
),
( # test backward compatibility with old regex
"\n",
"▁\n",
RegexNormalizationStep(
regex_search_pattern=r"(^)(.+)",
replace_term=r"▁$2",
)
),
]
)
def test_regex_normalization(test_string, expected, layer):
Expand Down
Loading