Uh oh!
There was an error while loading. Please reload this page.
BpeTokenizer Cleanup - #7514
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements cleanup improvements for the BPE tokenizer by adding support for special tokens that are not part of the main vocabulary and simplifying the decode method implementation.
- Enhances special token handling for BeginningOfSentenceToken and EndOfSentenceToken when they exist only in special tokens
- Refactors the Decode method to use a single loop instead of duplicated logic
- Adds comprehensive test coverage for the new special token functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Microsoft.ML.Tokenizers/Model/BPETokenizer.cs | Enhanced constructor to check special tokens for BOS/EOS tokens and streamlined Decode method implementation |
| test/Microsoft.ML.Tokenizers.Tests/BpeTests.cs | Added comprehensive test case for special token handling with BOS/EOS tokens |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #7514 +/- ##
==========================================
+ Coverage 69.01% 69.02% +0.01%
==========================================
Files 1482 1482 Lines 274050 274092 +42 Branches 28266 28266 ==========================================
+ Hits 189128 189195 +67 + Misses 77526 77516 -10 + Partials 7396 7381 -15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Uh oh!
There was an error while loading. Please reload this page.
* BpeTokenizer Cleanup * Apply suggestions from code review Co-authored-by: Eric StJohn <ericstj@microsoft.com> --------- Co-authored-by: Eric StJohn <ericstj@microsoft.com>
This change is a simple clean-up for the BPE tokenizer:
BeginningOfSentenceTokenandEndOfSentenceTokenwhen these tokens are not present in the vocabulary but are instead provided as special tokens by the tokenizer.Decodemethod.