fix(train): drop unknown tokens during training and inference - #359
Open
serhiizghama wants to merge 2 commits into
Open
fix(train): drop unknown tokens during training and inference#359serhiizghama wants to merge 2 commits into
serhiizghama wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Contributor
|
Thanks for your PR, nice find! @serhiizghama test coverage is a bit too low, can you make sure it passes? You are missing a test where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same discrepancy as #353, but on the training path rather than the ONNX one.
StaticModel.tokenizedrops the unk token, whileBaseFinetuneable.tokenizeand_prepare_datasetkeep it — so a classifier trains and predicts with unk ids still in the sequence, and theto_pipeline()/to_static_model()artifact then drops them. In a small repro built on the mock vocab from the tests,clf.predict_probaandclf.to_pipeline().predict_probacome out 0.13 apart on the same input.Made both paths mirror
StaticModel.tokenize: strip unk first, then truncate. A text that is entirely unknown collapses to an empty sequence, which behaves like an empty string does today and lines up with the zero vector the static model returns for it, so there's no new edge case.The test checks the trainable tokenizer and the training dataset against
StaticModel.tokenizedirectly; it fails on main for all three tokenizer fixtures.