Replace removed tokenizer.encode_plus in DatasetEncoder - #2636
Open
rrrxxx0510 wants to merge 1 commit into
Open
Conversation
encode_plus was removed in transformers 5.x, so any run using
TopkRetriever (which encodes few-shot examples via DatasetEncoder)
crashes on import-time call:
AttributeError: Qwen2Tokenizer has no attribute encode_plus
The tokenizer call API is a drop-in replacement here: for a single
string it returns the same [1, L] input_ids / attention_mask tensors,
and verbose is still accepted.
Verified with a real Qwen2Tokenizer on transformers 5.16: the old call
raises the AttributeError above, the direct call produces the same
per-sample [L] tensors DatasetEncoder stores.
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 #2635
encode_pluswas removed in transformers 5.x, so any run using TopkRetriever (which encodes few-shot examples throughDatasetEncoder) crashes:Same class of breakage as #2573. The tokenizer call API is a drop-in replacement here — for a single string it returns the same
[1, L]input_ids/attention_masktensors, andverboseis still accepted.Verified with a real Qwen2Tokenizer on transformers 5.16: the old call raises the AttributeError above, the direct call produces the same per-sample
[L]tensorsDatasetEncoderstores.