Skip to content

fix: six issues from code review#2

Merged
neluca merged 1 commit into
mainfrom
fix/six-issues
Jun 15, 2026
Merged

fix: six issues from code review#2
neluca merged 1 commit into
mainfrom
fix/six-issues

Conversation

@neluca

@neluca neluca commented Jun 15, 2026

Copy link
Copy Markdown
Owner
  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.

Description

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Code style / refactoring
  • Other (please describe):

Checklist

  • I have run ruff format and ruff check on changed files
  • I have run mypy tinybpe/ --strict and no new errors were introduced
  • I have added tests for the changes
  • All tests pass (pytest tests/)
  • Coverage remains above 95% (pytest --cov=tinybpe tests/)
  • I have updated documentation if applicable

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.
@neluca neluca merged commit e0106ff into main Jun 15, 2026
21 of 22 checks passed
@codecov-commenter

Copy link
Copy Markdown

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 ☂️

@neluca neluca deleted the fix/six-issues branch June 15, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants