[
https://issues.apache.org/jira/browse/BEAM-14044?focusedWorklogId=772908&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-772908
]
ASF GitHub Bot logged work on BEAM-14044:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 20/May/22 16:54
Start Date: 20/May/22 16:54
Worklog Time Spent: 10m
Work Description: zwestrick commented on code in PR #17527:
URL: https://github.com/apache/beam/pull/17527#discussion_r878354771
##########
sdks/python/apache_beam/ml/inference/base_test.py:
##########
@@ -72,6 +72,21 @@ def process(self, prediction_result):
yield prediction_result.inference
+class FakeInferenceRunnerNeedsBigBatch(FakeInferenceRunner):
+ def run_inference(self, batch, unused_model):
+ if len(batch) < 100:
+ raise ValueError('Unexpectedly small batch')
+ return batch
+
+
+class FakeLoaderWithBatchArgForwarding(FakeModelLoader):
+ def get_inference_runner(self):
+ return FakeInferenceRunnerNeedsBigBatch()
+
+ def batch_elements_kwargs(self):
+ return {'min_batch_size': 9999}
Review Comment:
It makes the test much more difficult to write, since the actual batch size
chosen in that case would be nondeterministic, so it's difficult to distinguish
between size 1 batches due to randomness and size 1 batches due to forwarding
the correct args.
Issue Time Tracking
-------------------
Worklog Id: (was: 772908)
Time Spent: 1h 40m (was: 1.5h)
> Hook In Batching DoFn Apis to RunInference
> ------------------------------------------
>
> Key: BEAM-14044
> URL: https://issues.apache.org/jira/browse/BEAM-14044
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-py-core
> Reporter: Ryan Thompson
> Assignee: Brian Hulette
> Priority: P2
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> Hook into the batching DoFn APIs to the base RunInference interface.
> We should also investigate what defaults we should set for batching, and
> perhaps make that part of the API.
> See
> [s.apache.org/batched-dofns|https://www.google.com/url?q=http://s.apache.org/batched-dofns&sa=D&source=docs&ust=1646063987404027&usg=AOvVaw1VO9QgWlbAhx0Rh2Bzl1nw]
> for more details.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)