Added zero token_type_ids if tokenizer output does not have them #17
Open
GrayWizard12345 wants to merge 4 commits intoDen4ikAI:mainfrom
Open
Added zero token_type_ids if tokenizer output does not have them #17GrayWizard12345 wants to merge 4 commits intoDen4ikAI:mainfrom
GrayWizard12345 wants to merge 4 commits intoDen4ikAI:mainfrom
Conversation
Co-authored-by: GrayWizard12345 <24612767+GrayWizard12345@users.noreply.github.com>
Co-authored-by: GrayWizard12345 <24612767+GrayWizard12345@users.noreply.github.com>
…oken-type-ids Add missing token_type_ids to accent model inputs
There was a problem hiding this comment.
Pull request overview
This PR fixes a compatibility issue between the CharTokenizer and ONNX models by ensuring token_type_ids are present in tokenizer outputs, and adds standard Python build artifact exclusions to version control.
Changes:
- Added automatic insertion of zero-valued token_type_ids when missing from CharTokenizer output in accent_model.py
- Created .gitignore file with standard Python project exclusions
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ruaccent/accent_model.py | Adds token_type_ids (zeros with same shape as input_ids) if missing from tokenizer output, fixing ONNX model compatibility |
| .gitignore | Adds standard Python project ignore patterns for build artifacts, virtual environments, IDE files, and OS-specific files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
The ONNX model expects token_type_ids as an input parameter, but the CharTokenizer doesn't automatically include them when using return_tensors="np".
Fixed accent_model.py: Modified the put_accent method (lines 32-51) to add token_type_ids if they're missing from the tokenizer output. The fix adds zeros with the same shape as input_ids, which is the correct default value for single-sequence inputs.
Added .gitignore: Created a proper .gitignore file to prevent build artifacts like pycache from being committed to the repository.