[yaml] - Add huggingface model handler#38110
[yaml] - Add huggingface model handler#38110derrickaw wants to merge 13 commits intoapache:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request extends the Apache Beam YAML support by integrating HuggingFace model handlers. It introduces a new provider class that allows users to leverage HuggingFace pipelines directly within their YAML-defined pipelines, facilitating easier machine learning model inference workflows. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Blocked on #35198 |
17c61f2 to
dd26577
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for HuggingFace pipelines in Beam YAML by implementing the HuggingFacePipelineProvider and adding a corresponding integration test. The review feedback suggests refining the HuggingFacePipelineProvider by using None as default values for task and model, updating the device type hint to support integer GPU indices, and implementing a validate method to ensure either a task or model is specified at configuration time.
f1431f5 to
0dad77b
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for HuggingFace pipelines within Beam YAML by implementing the HuggingFacePipelineProvider and adding corresponding integration tests. It also updates the HuggingFace inference module to handle TFAutoModel imports more robustly. A critical issue was identified in the HuggingFacePipelineProvider where task and model parameters were being defaulted to empty strings instead of None, which could cause runtime failures in the transformers library.
There was a problem hiding this comment.
Code Review
This pull request introduces support for HuggingFace pipelines in Beam YAML by implementing the HuggingFacePipelineProvider and adding a corresponding integration test. Review feedback identifies a missing Any import in the huggingface_inference.py module that could lead to a runtime error. Additionally, the custom inference_fn in the new YAML test requires corrections to properly handle batch processing and align with the expected output format for assertions.
There was a problem hiding this comment.
Code Review
This pull request introduces support for HuggingFace pipelines within Beam YAML by adding the HuggingFacePipelineProvider and an associated integration test. The review feedback identifies a parameter naming discrepancy in the provider class and a logic error in the test's inference function, which needs to return an iterable to correctly handle batch results.
|
Assigning reviewers: R: @damccorm for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for HuggingFace pipelines in the Beam YAML ML API by implementing a new HuggingFacePipelineProvider and adding robust import handling for TFAutoModel. The review identifies critical issues in the provided YAML test configuration, specifically regarding the implementation of the real_inference function and the subsequent data access pattern, providing necessary code corrections to ensure proper batch processing and result mapping.
damccorm
left a comment
There was a problem hiding this comment.
Thanks, had a couple minor comments, but generally LGTM
| uses: ./.github/actions/gradle-command-self-hosted-action | ||
| with: | ||
| gradle-command: :sdks:python:yamlIntegrationTests -PbeamPythonExtra=ml_test,yaml | ||
| gradle-command: :sdks:python:yamlIntegrationTests -PbeamPythonExtra=ml_test,yaml,transformers |
There was a problem hiding this comment.
Doesn't have to happen in this PR, but is there a reason we can't just install these as part of the task by default?
Relatedly, I think we need this here as well:
| from transformers import TFAutoModel | ||
|
|
||
| try: | ||
| from transformers import TFAutoModel |
There was a problem hiding this comment.
What's special about TFAutoModel such that we now need to special case it, but not the other transformers imports?
73b207a to
02ce797
Compare
02ce797 to
a033482
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #38110 +/- ##
============================================
- Coverage 56.98% 56.97% -0.01%
Complexity 3628 3628
============================================
Files 1185 1185
Lines 189433 189457 +24
Branches 3751 3751
============================================
- Hits 107952 107948 -4
- Misses 78024 78052 +28
Partials 3457 3457
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Please add a meaningful description for your change here
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.