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

Add C++ regex support for Llama3, Standard Library, and Custom Cases #804

Merged
merged 10 commits into from
Sep 11, 2024

Conversation

sayanshaw24
Copy link
Contributor

@sayanshaw24 sayanshaw24 commented Sep 6, 2024

Currently, our regular expression pattern matching for BPE tokenization only supports the GPT2 regex.

This PR adds the following functionality:

  1. Standard library regex support.
  2. Llama3 regex support.
  3. Custom regex implementation that will use appropriate regex given a model.

@sayanshaw24 sayanshaw24 changed the title Add C++ standard library regex support for GPT2 case Add C++ standard library regex support Sep 9, 2024
@sayanshaw24 sayanshaw24 changed the title Add C++ standard library regex support Add C++ regex support for Llama3, Standard Library, and Custom Cases Sep 10, 2024
@sayanshaw24 sayanshaw24 marked this pull request as ready for review September 10, 2024 21:49
@sayanshaw24 sayanshaw24 requested a review from a team as a code owner September 10, 2024 21:49
@@ -133,7 +133,7 @@ TEST(OrtxTokenizerTest, Phi3_S_Tokenizer) {
EXPECT_NE(tokenizer, nullptr);

std::vector<extTokenId_t> EXPECTED_IDS_0 = {2028, 374, 264, 1296, 13};
std::vector<std::string_view> input = {"This is a test.", "the second one",
std::vector<std::string_view> input = {"This is a test.", "Ich liebe München",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the problem is related to this regular expression. Is it just an enhancement of unit test?

@sayanshaw24 sayanshaw24 merged commit 8bc8e43 into main Sep 11, 2024
46 checks passed
@sayanshaw24 sayanshaw24 deleted the sayanshaw/regex branch September 11, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants