damccorm commented on code in PR #26309:
URL: https://github.com/apache/beam/pull/26309#discussion_r1175768896
##########
sdks/python/apache_beam/ml/inference/base.py:
##########
@@ -174,6 +183,38 @@ def update_model_path(self, model_path: Optional[str] =
None):
"""Update the model paths produced by side inputs."""
pass
+ def get_preprocess_fns(self) -> Iterable[Callable[[Any], Any]]:
+ """Gets all preprocessing functions to be run before batching/inference.
+ Functions are in order that they should be applied."""
+ return []
+
+ def get_postprocess_fns(self) -> Iterable[Callable[[Any], Any]]:
+ """Gets all postprocessing functions to be run after inference.
+ Functions are in order that they should be applied."""
+ return []
+
+ def with_preprocess_fn(
+ self, fn: Callable[[PreProcessT], ExampleT]
+ ) -> 'ModelHandler[PreProcessT, PredictionT, ModelT, PreProcessT]':
Review Comment:
Putting it in quotes is intentional because this is a forward reference -
https://peps.python.org/pep-0484/#forward-references - basically, ModelHandler
hasn't been resolved yet at the time it is evaluated, putting it in quotes
tells the resolver to wait and do it later.
--
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]