damccorm commented on code in PR #23506:
URL: https://github.com/apache/beam/pull/23506#discussion_r989135356
##########
sdks/python/apache_beam/ml/inference/base_test.py:
##########
@@ -251,6 +255,59 @@ def
test_run_inference_keyed_examples_with_unkeyed_model_handler(self):
| 'RunKeyed' >> base.RunInference(model_handler))
pipeline.run()
+ def test_model_handler_compatibility(self):
+ # ** IMPORTANT ** Do not change this test to make your PR pass without
+ # first reading below.
+ # Be certain that the modification will not break third party
+ # implementations of ModelHandler.
+ # See issue https://github.com/apache/beam/issues/23484
+ # If this test fails, likely third party implementations of
+ # ModelHandler will break.
+ class ThirdPartyHandler(base.ModelHandler[int, int, FakeModel]):
+ def __init__(self, custom_parameter=None):
+ pass
+
+ def load_model(self) -> FakeModel:
+ return FakeModel()
+
+ def run_inference(
+ self,
+ batch: Sequence[int],
+ model: FakeModel,
+ inference_args: Optional[Dict[str, Any]] =None) -> Iterable[int]:
Review Comment:
```suggestion
inference_args: Optional[Dict[str, Any]] = None) -> Iterable[int]:
```
To make the linter happy :(
--
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]