tvalentyn commented on code in PR #21819: URL: https://github.com/apache/beam/pull/21819#discussion_r895734980
########## 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: ok. I thought the splitting of model handlers would allow us getting the type deterministically instead of having to make a union. we can look into it separately. cc: @robertwb @yeandy @rezarokni -- 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-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org