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

Fix mixed language tokenization in JiebaTokenizer #13035

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lyirs
Copy link

@lyirs lyirs commented Apr 28, 2024

Proposed changes:

  • Modify JiebaTokenizer.tokenize to correctly process mixed Chinese and English texts. This adjustment is aimed at resolving the issue where additional white space tokens were generated between Chinese and English tokens, which previously led to dimension mismatch errors during model training.

Detailed explanation:

  • Updated the tokenize method to skip whitespace tokens and accurately find each token's position using the text itself rather than relying solely on Jieba's output. This change helps prevent the dimension mismatch error and is a response to the issues reported in Jira as OSS-275 and OSS-539.

Benefits:

  • Prevents training errors when training data contains mixed Chinese and English languages.
  • Improves the robustness of tokenization in mixed language scenarios.

Related Jira Issues:

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

Additional notes:

  • Further testing in different operational environments is recommended to ensure compatibility and efficiency.

@lyirs lyirs requested a review from a team as a code owner April 28, 2024 09:16
@CLAassistant
Copy link

CLAassistant commented Apr 28, 2024

CLA assistant check
All committers have signed the CLA.

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