Repository navigation
Conversation
…ng and MLM IT - huggingface_inference.py & huggingface_inference_test.py: wrap single-dict predictions returned by Hugging Face pipelines (e.g. QuestionAnsweringPipeline on batch size 1) in a list inside _default_pipeline_inference_fn before utils._convert_to_result, fixing the regression from apache#36593 while preserving custom inference_fn implementations that return columnar dicts (e.g. Beam YAML). - huggingface_inference_it_test.py, huggingface_language_modeling.py, README.md: replace the deleted/private stevhliu/my_awesome_eli5_mlm_model Hub checkpoint with FacebookAI/roberta-base (inlining expected outputs so the shared GCS golden file is unchanged) and replace removed tokenizer.encode_plus with tokenizer(...) for transformers 5.x compatibility.
5 tasks
Contributor
Author
|
Replaced by native stacked PR #41645. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41640 +/- ##
=========================================
Coverage 58.03% 58.04%
Complexity 2844 2844
=========================================
Files 1210 1210
Lines 173259 173282 +23
Branches 2329 2329
=========================================
+ Hits 100554 100581 +27
+ Misses 69995 69991 -4
Partials 2710 2710
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 two issues blocking
direct:py313:transformersInferenceTest:HuggingFacePipelineModelHandlersingle-element batch regression (huggingface_inference.py,huggingface_inference_test.py):HuggingFacePipelineModelHandler.run_inferencetoutils._convert_to_result, Hugging Face pipelines that return a singledict(instead of alist[dict]) for batch size 1 — such asQuestionAnsweringPipeline— crashed withTypeError: 'float' object is not iterablebecauseutils._convert_to_resulttreats a baredictas a columnar dict of batch-length iterables.isinstance(predictions, dict) and len(batch) == 1into[predictions]inside_default_pipeline_inference_fnso built-in HF pipelines work for batch size 1 while custominference_fnimplementations that intentionally return columnar dicts (such as Beam YAML'sruninference_huggingface.yaml) remain untouched.inference_fns.Unavailable third-party Hub model &
transformers>=5tokenizer call (huggingface_inference_it_test.py,huggingface_language_modeling.py,examples/inference/README.md):stevhliu/my_awesome_eli5_mlm_modelwithFacebookAI/roberta-base, inlining_EXPECTED_MASKED_LM_OUTPUTSinhuggingface_inference_it_test.pyso the shared GCS golden file is left unchanged for older release branches.tokenizer.encode_plus(...)withtokenizer(...)inhuggingface_language_modeling.pyfortransformers>=5compatibility.Verification
direct:py313:transformersInferenceTest(3/3 passed) locally and in PostCommit Python (3.13) run 45406881889 on Re-enable Direct and Dataflow inferencePostCommitIT in python313PostCommit #41595.Part of the stack leading up to re-enabling Python 3.13
inferencePostCommitITin #41595 (independent of the other prerequisite PRs; can be merged in any order).