fix: six issues from code review#2
Merged
Merged
Conversation
1. Fix version string from 1.0.0 to 1.1.0 in _version.py (P0) The version bump was missed in the v1.1.0 release. 2. Fix special tokens silently discarded for non-remap models (P0) _registry.py now checks whether special token IDs fall outside the vocab range before applying them. qwen35 (IDs 248044+) now correctly receives its 3 special tokens. Models with conflicting IDs (deepseek-v4, llama4, minicpm5) now emit a clear warning explaining the issue instead of silently dropping special tokens. 3. Fix streaming decode performance for byte-remap models (P1) _decode_remap now uses a cached inverse-remapped vocab dict for O(1) per-token lookup, replacing the full batch decode call that made streaming decode O(n²) for GPT-family models. 4. Export get_model_info in the public API (P2) Added to __all__, imports, and module docstring in __init__.py. 5. Add count_tokens() convenience method (P2) New method on Tokenizer: len(encode(text)) without the verbosity. 6. Clarify encode_ordinary documentation (P3) Rewrote docstring to accurately describe the difference between encode() and encode_ordinary(), including a note about edge cases. Updated README, README_zh, and CHANGELOG to reflect the changes.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
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.
Fix version string from 1.0.0 to 1.1.0 in _version.py (P0) The version bump was missed in the v1.1.0 release.
Fix special tokens silently discarded for non-remap models (P0) _registry.py now checks whether special token IDs fall outside the vocab range before applying them. qwen35 (IDs 248044+) now correctly receives its 3 special tokens. Models with conflicting IDs (deepseek-v4, llama4, minicpm5) now emit a clear warning explaining the issue instead of silently dropping special tokens.
Fix streaming decode performance for byte-remap models (P1) _decode_remap now uses a cached inverse-remapped vocab dict for O(1) per-token lookup, replacing the full batch decode call that made streaming decode O(n²) for GPT-family models.
Export get_model_info in the public API (P2) Added to all, imports, and module docstring in init.py.
Add count_tokens() convenience method (P2) New method on Tokenizer: len(encode(text)) without the verbosity.
Clarify encode_ordinary documentation (P3) Rewrote docstring to accurately describe the difference between encode() and encode_ordinary(), including a note about edge cases.
Updated README, README_zh, and CHANGELOG to reflect the changes.
Description
Type of change
Checklist
ruff formatandruff checkon changed filesmypy tinybpe/ --strictand no new errors were introducedpytest tests/)pytest --cov=tinybpe tests/)