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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some more overhead from GPT3Tokenizer #675

Merged
merged 4 commits into from Apr 27, 2023

Conversation

stephentoub
Copy link
Member

Motivation and Context

Some more low-hanging fruit reduction in GPT3Tokenizer.

Description

  • We can both simplify and make faster the parsing of the vocab.bpe file
  • We can remove the SortedDictionary from BytePairEncoding, including a full O(N) iteration of the dictionary on every iteration of the outer loop (as part of the Min() call).

Tests before:
image

Tests after:
image

Contribution Checklist

- We can both simplify and make faster the parsing of the vocab.bpe file
- We can remove the SortedDictionary from BytePairEncoding, including a full O(N) iteration of the dictionary on every iteration of the outer loop (as part of the Min() call).
@github-actions github-actions bot added the .NET Issue or Pull requests regarding .NET code label Apr 26, 2023
dluc
dluc previously approved these changes Apr 27, 2023
@dluc dluc merged commit 8fc9d7a into microsoft:main Apr 27, 2023
11 checks passed
dluc added a commit that referenced this pull request Apr 29, 2023
### Motivation and Context

Some more low-hanging fruit reduction in GPT3Tokenizer.

### Description

- We can both simplify and make faster the parsing of the vocab.bpe file
- We can remove the SortedDictionary from BytePairEncoding, including a
full O(N) iteration of the dictionary on every iteration of the outer
loop (as part of the Min() call).


Co-authored-by: Devis Lucato <dluc@users.noreply.github.com>
Co-authored-by: Devis Lucato <devis@microsoft.com>
dehoward pushed a commit to lemillermicrosoft/semantic-kernel that referenced this pull request Jun 1, 2023
### Motivation and Context

Some more low-hanging fruit reduction in GPT3Tokenizer.

### Description

- We can both simplify and make faster the parsing of the vocab.bpe file
- We can remove the SortedDictionary from BytePairEncoding, including a
full O(N) iteration of the dictionary on every iteration of the outer
loop (as part of the Min() call).


Co-authored-by: Devis Lucato <dluc@users.noreply.github.com>
Co-authored-by: Devis Lucato <devis@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants