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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]