Repository navigation
Keep evaluator pipeline dispatch compatible with Transformers 5 - #906
Open
snygginghani wants to merge 1 commit into
Open
snygginghani wants to merge 1 commit into
snygginghani wants to merge 1 commit into
Conversation
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.
A supplied pipeline or default model falls through the early isinstance checks and looks up transformers.TFPreTrainedModel even when it will not use TensorFlow. Transformers 5 removed that class, so normal Evaluate calls raise AttributeError. Check for the optional legacy class without requiring it to exist.
I reproduced the failure on Transformers 5.24.1 with a text-generation pipeline built from the published hf-internal-testing/tiny-random-gpt2 checkpoint and passed to evaluate.evaluator("text-generation").compute. With the fix, the pipeline produced output and the local word_count evaluator reported 8 total words and 7 unique words.
The supplied/default dispatch tests failed on main and now pass. The third test preserves dispatch for a legacy TensorFlow model class. Black, isort, flake8 and git diff --check passed.
Prepared with AI assistance.