AoA: tokenizer loading fallbacks for transformers-5.x-saved checkpoints - #5
Open
bylinina wants to merge 2 commits into
Open
AoA: tokenizer loading fallbacks for transformers-5.x-saved checkpoints#5bylinina wants to merge 2 commits into
bylinina wants to merge 2 commits into
Conversation
…eTrainedTokenizerFast), matching other pipeline call sites
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.
Models saved with transformers 5.x record tokenizer_class: TokenizersBackend, which transformers 4.51.3 (pinned by this pipeline) cannot resolve. The rest of the pipeline (sentence_zero_shot, reading, finetune) already handles this via a PreTrainedTokenizerFast fallback (merged in #3); the AoA module has two call sites that were missed:
evaluation_functions.load_tokenizer_for_step — the AutoProcessor load raises per checkpoint, the surprisal loop swallows it, and the run completes "successfully" with an empty results dir (no surprisal.json; AoA is silently set to None at collation).
run.py scoring step — a raw AutoTokenizer load crashes after surprisal extraction succeeds, so aoa_score.json is never written.
This PR applies the same 3-level fallback (AutoProcessor → AutoTokenizer → PreTrainedTokenizerFast) to both call sites, matching the existing pattern. Tested on DeBERTa MLM checkpoints saved with transformers 5.x: both failure modes reproduce on upstream main and are resolved with this patch (surprisal extraction across 19 chck_*M revisions + scoring complete). No behavior change for models whose tokenizers load via AutoProcessor.