Skip to content
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

[Python] Implemented Hugging Face Model Handler #26632

Merged
merged 29 commits into from
Jul 24, 2023

Conversation

riteshghorse
Copy link
Contributor

@riteshghorse riteshghorse commented May 10, 2023

This PR adds a model handler for loading PyTorch and TensorFlow model handler from Hugging Face Hub.
It builds on this Design doc

Example Job on Dataflow with huggingface_language_modeling.py


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: 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, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

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)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@riteshghorse riteshghorse marked this pull request as ready for review June 27, 2023 14:55
@riteshghorse riteshghorse changed the title [WIP] Hugging Face Model Handler with AutoModel Hugging Face Model Handler with AutoModel Jun 27, 2023
@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@riteshghorse
Copy link
Contributor Author

Run Python 3.8 PostCommit

@riteshghorse
Copy link
Contributor Author

Run Python 3.11 PostCommit

@riteshghorse riteshghorse changed the title Hugging Face Model Handler with AutoModel [Python] Implemented Hugging Face Model Handler Jun 27, 2023
@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Merging #26632 (4bdab80) into master (843e7fd) will decrease coverage by 0.25%.
The diff coverage is 3.75%.

@@            Coverage Diff             @@
##           master   #26632      +/-   ##
==========================================
- Coverage   71.22%   70.97%   -0.25%     
==========================================
  Files         862      863       +1     
  Lines      104674   104811     +137     
==========================================
- Hits        74553    74394     -159     
- Misses      28573    28869     +296     
  Partials     1548     1548              
Flag Coverage Δ
python 80.00% <3.75%> (-0.44%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../apache_beam/ml/inference/huggingface_inference.py 0.00% <0.00%> (ø)
...xamples/inference/huggingface_language_modeling.py 13.23% <13.23%> (ø)

... and 33 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @AnandInguva for label python.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@riteshghorse
Copy link
Contributor Author

Run Python 3.8 PostCommit

@riteshghorse
Copy link
Contributor Author

Run Python 3.11 PostCommit

@riteshghorse
Copy link
Contributor Author

@AnandInguva Robert approved the design. Can you take a final look before merging this?

@riteshghorse
Copy link
Contributor Author

Run Python 3.8 PostCommit

@riteshghorse
Copy link
Contributor Author

Run Python 3.11 PostCommit

Copy link
Contributor

@AnandInguva AnandInguva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks. Feel free to merge once the tests are green(if they are related to this PR)

@riteshghorse
Copy link
Contributor Author

Run Python 3.8 PostCommit

@riteshghorse
Copy link
Contributor Author

Run Python 3.11 PostCommit

@riteshghorse
Copy link
Contributor Author

Python 3.8 PC passed for huggingface_inference_it_test
image

@riteshghorse
Copy link
Contributor Author

Run Python 3.11 PostCommit

@riteshghorse
Copy link
Contributor Author

Python 3.11 failure is because of #27643

@riteshghorse
Copy link
Contributor Author

Merging this!

@riteshghorse riteshghorse merged commit 193b720 into apache:master Jul 24, 2023
73 of 76 checks passed
@riteshghorse riteshghorse deleted the hf-model-handler-auto branch July 24, 2023 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants