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

Add docs for per key inference #28243

Merged
merged 13 commits into from
Oct 12, 2023

Conversation

damccorm
Copy link
Contributor

@damccorm damccorm commented Aug 30, 2023

This should not be merged until release 2.51 is finalized.

RENDERED

Part of #27628


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 or the workflows README to see a list of phrases to trigger workflows.

@damccorm damccorm marked this pull request as ready for review September 8, 2023 12:16
@damccorm
Copy link
Contributor Author

damccorm commented Sep 8, 2023

R: @tvalentyn

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

Copy link
Contributor

@tvalentyn tvalentyn left a comment

Choose a reason for hiding this comment

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

Very nice, thanks, @damccorm ! Consider getting a review from TW folks before merging as well.

keyed_model_handler = KeyedModelHandler(mhs, max_models_per_worker_hint=2)
```

The previous example will load at most 2 models per worker at any given time, and will unload models that aren't
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous example will load at most 2 models per worker at any given time

Have we tried running multi-key inference under load, for example 10 models, many examples, but only 1 model can fit in memory? We could try that with and without GBK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't yet, but its a good idea I can follow up with

keyed_model_handler = KeyedModelHandler(mhs, max_models_per_worker_hint=2)
```

The previous example will load at most 2 models per worker at any given time, and will unload models that aren't
Copy link
Contributor

Choose a reason for hiding this comment

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

load at most 2 models per worker

Users might perceive it as a guarantee, and come to us if/when they see a single OOM error. If this cannot be guaranteed, we can phrase that the upper ceiling is enforced as best effort. Or mention that there may be some delay between when the model is unloaded and the memory is freed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mentioned that there's some delay, let me know if you think the wording is ok

@damccorm
Copy link
Contributor Author

retest this please

@damccorm
Copy link
Contributor Author

Run Portable_Python PreCommit

@damccorm
Copy link
Contributor Author

Run Python PreCommit

@damccorm
Copy link
Contributor Author

Run PythonDocker PreCommit

@damccorm
Copy link
Contributor Author

Run PythonDocs PreCommit

@damccorm
Copy link
Contributor Author

Run Python_Coverage PreCommit

@damccorm
Copy link
Contributor Author

Run Python_Dataframes PreCommit

@damccorm
Copy link
Contributor Author

Run Python_Examples PreCommit

@damccorm
Copy link
Contributor Author

Run Python_Integration PreCommit

@damccorm
Copy link
Contributor Author

Run Python_PVR_Flink PreCommit

@damccorm
Copy link
Contributor Author

Run Python_Runners PreCommit

@damccorm
Copy link
Contributor Author

Run Python_Transforms PreCommit

@damccorm
Copy link
Contributor Author

Run Website PreCommit

@damccorm
Copy link
Contributor Author

Run Website_Stage_GCS PreCommit

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Merging #28243 (7ff66f2) into master (603b517) will increase coverage by 0.00%.
Report is 34 commits behind head on master.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #28243   +/-   ##
=======================================
  Coverage   72.34%   72.35%           
=======================================
  Files         682      682           
  Lines      100536   100541    +5     
=======================================
+ Hits        72737    72747   +10     
+ Misses      26221    26216    -5     
  Partials     1578     1578           
Flag Coverage Δ
python 82.88% <ø> (+<0.01%) ⬆️

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

Files Changed Coverage Δ
sdks/python/apache_beam/ml/inference/base.py 93.51% <ø> (ø)

... and 6 files with indirect coverage changes

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

@damccorm
Copy link
Contributor Author

R: @rszper

sdks/python/apache_beam/ml/inference/base.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/ml/inference/base.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/ml/inference/base.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/ml/inference/base.py Outdated Show resolved Hide resolved
sdks/python/apache_beam/ml/inference/base.py Outdated Show resolved Hide resolved
@damccorm damccorm merged commit 835bd65 into apache:master Oct 12, 2023
79 checks passed
@damccorm damccorm deleted the users/damccorm/keyedMhDocs branch October 12, 2023 13:25
damondouglas pushed a commit to damondouglas/beam that referenced this pull request Oct 16, 2023
* Update KeyMhMapping to KeyModelMapping

* Add docs for per key inference

* Add piece on memory thrashing

* Whitespace

* Update wording based on feedback

* Add references to website in pydoc

* Apply suggestions from code review

Co-authored-by: Rebecca Szper <[email protected]>

* Remove ordering implied by wording

* Lint fixes

---------

Co-authored-by: Rebecca Szper <[email protected]>
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.

3 participants