Skip to content

Commit

Permalink
Fix typo - metdata -> metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
damccorm committed Feb 9, 2023
1 parent e659c83 commit bf709ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ def run(argv=None, save_main_session=True):
options.view_as(SetupOptions).save_main_session = save_main_session

class GetModel(beam.DoFn):
def process(self, element) -> Iterable[base.ModelMetdata]:
def process(self, element) -> Iterable[base.ModelMetadata]:
if time.time() > mid_ts:
yield base.ModelMetdata(
yield base.ModelMetadata(
model_id='model_add.pkl', model_name='model_add')
else:
yield base.ModelMetdata(
yield base.ModelMetadata(
model_id='model_sub.pkl', model_name='model_sub')

class _EmitSingletonSideInput(beam.DoFn):
Expand Down
10 changes: 5 additions & 5 deletions sdks/python/apache_beam/ml/inference/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def __new__(cls, example, inference, model_id=None):
PredictionResult.model_id.__doc__ = """Model ID used to run the prediction."""


class ModelMetdata(NamedTuple):
class ModelMetadata(NamedTuple):
model_id: str
model_name: str


ModelMetdata.model_id.__doc__ = """Unique identifier for the model. This can be
ModelMetadata.model_id.__doc__ = """Unique identifier for the model. This can be
a file path or a URL where the model can be accessed. It is used to load
the model for inference."""
ModelMetdata.model_name.__doc__ = """Human-readable name for the model. This
ModelMetadata.model_name.__doc__ = """Human-readable name for the model. This
can be used to identify the model in the metrics generated by the
RunInference transform."""

Expand Down Expand Up @@ -310,7 +310,7 @@ def __init__(
inference_args: Optional[Dict[str, Any]] = None,
metrics_namespace: Optional[str] = None,
*,
model_metadata_pcoll: beam.PCollection[ModelMetdata] = None):
model_metadata_pcoll: beam.PCollection[ModelMetadata] = None):
"""
A transform that takes a PCollection of examples (or features) for use
on an ML model. The transform then outputs inferences (or predictions) for
Expand Down Expand Up @@ -530,7 +530,7 @@ def _run_inference(self, batch, inference_args):
return predictions

def process(
self, batch, inference_args, si_model_metadata: Optional[ModelMetdata]):
self, batch, inference_args, si_model_metadata: Optional[ModelMetadata]):
"""
When side input is enabled:
The method checks if the side input model has been updated, and if so,
Expand Down
6 changes: 3 additions & 3 deletions sdks/python/apache_beam/ml/inference/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def test_run_inference_with_iterable_side_input(self):
test_pipeline = TestPipeline()
side_input = (
test_pipeline | "CreateDummySideInput" >> beam.Create(
[base.ModelMetdata(1, 1), base.ModelMetdata(2, 2)])
[base.ModelMetadata(1, 1), base.ModelMetadata(2, 2)])
| "ApplySideInputWindow" >> beam.WindowInto(
window.GlobalWindows(),
trigger=trigger.Repeatedly(trigger.AfterProcessingTime(1)),
Expand Down Expand Up @@ -442,11 +442,11 @@ def test_run_inference_side_input_in_batch(self):

sample_side_input_elements = [(
first_ts + 8,
base.ModelMetdata(
base.ModelMetadata(
model_id='fake_model_id_1', model_name='fake_model_id_1')),
(
first_ts + 15,
base.ModelMetdata(
base.ModelMetadata(
model_id='fake_model_id_2',
model_name='fake_model_id_2'))]

Expand Down

0 comments on commit bf709ea

Please sign in to comment.