-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Embeddings in mltransform #29564
Support Embeddings in mltransform #29564
Conversation
Fix tox.ini Fix pydoc Fix indent in pydoc
R: @damccorm This is ready for review. |
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chunking the review a bit. Just reviewed base.py thus far, though I imagine that's the place I'll have the most comments
sdks/python/apache_beam/ml/transforms/embeddings/tensorflow_hub_test.py
Outdated
Show resolved
Hide resolved
sdks/python/apache_beam/ml/transforms/embeddings/sentence_transformer.py
Outdated
Show resolved
Hide resolved
sdks/python/apache_beam/ml/transforms/embeddings/tensorflow_hub.py
Outdated
Show resolved
Hide resolved
sdks/python/apache_beam/ml/transforms/embeddings/sentence_transformer.py
Outdated
Show resolved
Hide resolved
sdks/python/apache_beam/ml/transforms/embeddings/sentence_transformer_test.py
Outdated
Show resolved
Hide resolved
… on different machines
This reverts commit cfb1883.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly looks good, had a few more comments though
raise FileExistsError( | ||
"The artifact location %s already exists and contains %s. Please " | ||
"specify a different location." % | ||
(artifact_location, _ATTRIBUTE_FILE_NAME)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call - one possible future enhancement would be to support an overwrite argument that allows users to do this
sdks/python/apache_beam/ml/transforms/embeddings/vertex_ai_test.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last nit, otherwise this LGTM. Feel free to make the change and merge once checks pass
Co-authored-by: Danny McCormick <[email protected]>
Each config will define its own model handler so that model handler can be compatible with the inputs passed to the MLTransform.
This PR supports
vertex_ai
,hugging face
(sentence-transformers).Changes made:
ProcessHandler
a PTransform._TextEmbeddingHandler
which takes aModelHandler
but it is responsible to work onDict[str, Any]
inputs.MLTransform
would be the container that holds the list of transforms and these list of transforms are passed to the_MLTransformToPTransformMapper
which maps each data processing transforms to its PTransformjsonpickle
to store and load the ptransforms instances. This is done to seal the gap between training and inference.jsonpickle
is cross compatible across python versions and has backward compatibility with older versions of its versions.This PR will throw if input is a
Dict[str, List[str]]
. Works forDict[str, str]
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.md
with 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.