Repository navigation
Updates YAML template to set ML dependencies for runtime - #4443
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 enhances the Beam YAML template by automating the detection and installation of required ML dependencies. By analyzing the pipeline configuration, the template now dynamically determines and sets the appropriate runtime requirements for 'RunInference' and 'MLTransform' components. Additionally, it introduces robust testing and validation mechanisms to ensure that these dependency versions stay synchronized with the core Apache Beam library, reducing the risk of version mismatches in production environments. Highlights
Ignored Files
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 the 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 counterproductive. 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces dynamic resolution of runtime dependencies for ML transforms in Beam YAML pipelines. It adds a new module ml_dependencies.py to parse YAML pipelines and identify additional dependencies (such as PyTorch, TensorFlow, and Sentence Transformers) when the 'ML' experimental feature is enabled, along with a validation script and comprehensive tests. The feedback highlights a critical Python 3.8 compatibility issue with argparse.ArgumentParser's exit_on_error parameter, and suggests improvements such as making the framework string check case-insensitive, passing a copy of arguments defensively, and explicitly specifying UTF-8 encoding when opening files across the codebase.
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #4443 +/- ##
=============================================
- Coverage 57.02% 38.03% -19.00%
+ Complexity 8031 518 -7513
=============================================
Files 1156 195 -961
Lines 73749 11885 -61864
Branches 8696 1213 -7483
=============================================
- Hits 42058 4520 -37538
+ Misses 28892 6994 -21898
+ Partials 2799 371 -2428
🚀 New features to boost your workflow:
|
The workflow (.github/workflows/yaml-ml-dependencies.yml) and the script that it runs (python/src/test/python/yaml-template/check_ml_dependencies.py) will be added in a follow-up PR to keep this PR smaller.
f5861fc to
3f2ca3f
Compare
|
@damccorm @derrickaw PTAL. |
damccorm
left a comment
There was a problem hiding this comment.
Thanks - I think this is a step in the right direction. I am also interested in simplifying in the future since we're effectively taking on some technical debt here.
Inspects incoming YAML pipelines for usage of Beam ML transforms 'RunInference' and 'MLTransform'.
If these are detected, sets correct dependencies for the runtime by modifying the default requirements file.
The set of dependencies is customized based on the specific RunInference model handlers and/or specific MLTransform transformations used by the pipeline.
Also adds following Github actions updates updates the existing Python/YAML PR action to include YAML template unit tests.
In a separate PR, I'll add a new Github action to make sure that the dependency versions set here stay consistent with the dependency versions configured in the Beam setup.py file. Not adding it here due to the PR size.