Refactor tokenizer adapter to support special EOS token #927
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.
Add BOS/EOS Token Handling in Tokenizer Adapter
The tokenizer adapter now supports configurable beginning-of-sequence (BOS) and end-of-sequence (EOS) token insertion through
add_bosandadd_eosflags. This feature is essential for Supervised Fine-Tuning (SFT) workflows where:The implementation automatically prepends or appends the respective tokens based on the specified flags.
Special EOS Token Support
The tokenizer adapter allows you to specify custom EOS tokens for models that use non-standard sequence terminators. This is particularly useful for instruction-tuned models:
<end_of_turn>as their EOS token instead of the standard tokenThese enhancements include comprehensive unit tests to verify correct token handling behavior across various scenarios.
Checklist