Repository navigation
[Python] Support max_batch_weight in BatchElements and honor element_size_fn in stateful batching - #40603
Closed
tvalentyn wants to merge 2 commits into
Closed
[Python] Support max_batch_weight in BatchElements and honor element_size_fn in stateful batching#40603tvalentyn wants to merge 2 commits into
tvalentyn wants to merge 2 commits into
Conversation
…size_fn in stateful batching * Add max_batch_weight to BatchElements. When set, the batch size limits count elements and element_size_fn gives the weight of an element. This fixes RunInference failing with a TypeError when a ModelHandler sets max_batch_weight. * Honor element_size_fn when max_batch_duration_secs is set. This uses a separate stateful DoFn that only adds a 'weight' state and keeps the transform label, so pipelines that don't set element_size_fn are unaffected. * Never emit an empty batch when an element exceeds the limits on its own. * Warn when length_fn is set without max_batch_duration_secs, since it is ignored.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40603 +/- ##
=============================================
+ Coverage 56.16% 79.92% +23.75%
=============================================
Files 1124 488 -636
Lines 178336 82489 -95847
Branches 1489 0 -1489
=============================================
- Hits 100170 65929 -34241
+ Misses 75645 16560 -59085
+ Partials 2521 0 -2521
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
count elements and element_size_fn gives the weight of an element. This
fixes RunInference failing with a TypeError when a ModelHandler sets
max_batch_weight.
separate stateful DoFn that only adds a 'weight' state and keeps the
transform label, so pipelines that don't set element_size_fn are
unaffected.
ignored.<!--
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123orfixes #456).CHANGES.mdwith noteworthy changes.See CONTRIBUTING.md for more details.
-->