[
https://issues.apache.org/jira/browse/BEAM-14524?focusedWorklogId=777121&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-777121
]
ASF GitHub Bot logged work on BEAM-14524:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Jun/22 19:26
Start Date: 01/Jun/22 19:26
Worklog Time Spent: 10m
Work Description: ryanthompson591 commented on code in PR #17773:
URL: https://github.com/apache/beam/pull/17773#discussion_r883172356
##########
sdks/python/apache_beam/ml/inference/api.py:
##########
@@ -52,8 +52,12 @@ class RunInference(beam.PTransform):
TODO(BEAM-14046): Add and link to help documentation
"""
- def __init__(self, model_loader: base.ModelLoader):
- self._model_loader = model_loader
+ def __init__(
+ self, model_loader: Union[base.ModelLoader, Callable], return_row=False):
Review Comment:
If we do this we would really need to document what return_row does.
What I would prefer, is since we can still change our apis we should use one
interface or the other.
What do you think of the idea of only using one or the other beam.rows or
the PredictionResult dataclass?
##########
sdks/python/apache_beam/ml/inference/api.py:
##########
@@ -17,16 +17,17 @@
# mypy: ignore-errors
from dataclasses import dataclass
-from typing import Tuple
-from typing import TypeVar
-from typing import Union
+from typing import Callable
import apache_beam as beam
from apache_beam.ml.inference import base
+from apache_beam.typehints import Tuple
Review Comment:
I asked @robertwb about this in https://github.com/apache/beam/pull/17762.
He thought that we should prefer native types. Does that sound right?
##########
sdks/python/apache_beam/ml/inference/api.py:
##########
@@ -52,8 +52,12 @@ class RunInference(beam.PTransform):
TODO(BEAM-14046): Add and link to help documentation
"""
- def __init__(self, model_loader: base.ModelLoader):
- self._model_loader = model_loader
+ def __init__(
+ self, model_loader: Union[base.ModelLoader, Callable], return_row=False):
+ self._model_loader = model_loader() if isinstance(
Review Comment:
I don't get this. Is this for some callable that returns a model loader?
Where would we use this instead of just passing in a model loader?
Issue Time Tracking
-------------------
Worklog Id: (was: 777121)
Time Spent: 40m (was: 0.5h)
> Add return_row option to RunInference transform
> -----------------------------------------------
>
> Key: BEAM-14524
> URL: https://issues.apache.org/jira/browse/BEAM-14524
> Project: Beam
> Issue Type: Improvement
> Components: cross-language
> Reporter: Heejong Lee
> Assignee: Heejong Lee
> Priority: P2
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Add return_row option to RunInference transform.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)