Repository navigation
Add encode_batch_ids and make Tokenizer a PythonCall wrapper - #15
Merged
AntonOresten merged 1 commit intoOct 20, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 21 36 +15
=========================================
+ Hits 21 36 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
encode_batch_ids calls encode_batch_fast and writes the ids of all texts into one Julia vector through the buffer protocol, returning a view per text. Tokenizer now defines ispy and Py, so it can be passed to Python. Fixes MurrellGroup#13 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AntonOresten
force-pushed
the
cl/encode-batch-ids
branch
from
October 20, 2026 08:53
92cf80a to
0e202b4
Compare
Member
|
Thanks! |
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.
Fixes #13.
encode_batch_ids(tok, texts; T=UInt32, kwargs...)callsencode_batch_fastand returns a view per text into oneVector{T}(parent(ids[1])). Python writes the ids straight into Julia-allocated memory via the buffer protocol, so no numpy dependency and no per-EncodingJulia wrappers. Ids that don't fit inTthrow anOverflowError.TokenizerdefinesPythonCall.ispyandPy, so it can be passed to Python code directly.CondaPkg.tomlrequirestokenizers >= 0.20(first release withencode_batch_fast).10k docs (47 MB, 21.5M GPT-2 tokens),
T=UInt16, same batch run 5 times:encode_batchencode_batch_idsencode_batch_fast🤖 Generated with Claude Code