You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/13 13:26:05 UTC

[GitHub] [beam] tvalentyn commented on a diff in pull request #21819: Refactor code according to keyedModelHandler changes

tvalentyn commented on code in PR #21819:
URL: https://github.com/apache/beam/pull/21819#discussion_r895713829


##########
sdks/python/apache_beam/examples/inference/pytorch_image_classification.py:
##########
@@ -114,10 +115,13 @@ def run(argv=None, model_class=None, model_params=None, save_main_session=True):
     model_class = MobileNetV2
     model_params = {'num_classes': 1000}
 
-  model_loader = PytorchModelLoader(
-      state_dict_path=known_args.model_state_dict_path,
-      model_class=model_class,
-      model_params=model_params)
+  # the input to RunInference transform is keyed. Wrap
+  # PytorchModelHandler on KeyedModelHandler for keyed examples.
+  model_loader = KeyedModelHandler(
+      PytorchModelHandler(
+          state_dict_path=known_args.model_state_dict_path,
+          model_class=model_class,
+          model_params=model_params))

Review Comment:
   Do we still need the type hints on line 138?



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org