AnandInguva commented on code in PR #22164:
URL: https://github.com/apache/beam/pull/22164#discussion_r929616263


##########
sdks/python/apache_beam/examples/inference/pytorch_image_classification.py:
##########
@@ -120,27 +130,35 @@ def run(argv=None, model_class=None, model_params=None, 
save_main_session=True):
           model_class=model_class,
           model_params=model_params))
 
-  with beam.Pipeline(options=pipeline_options) as p:
-    filename_value_pair = (
-        p
-        | 'ReadImageNames' >> beam.io.ReadFromText(
-            known_args.input, skip_header_lines=1)
-        | 'ReadImageData' >> beam.Map(
-            lambda image_name: read_image(
-                image_file_name=image_name, path_to_dir=known_args.images_dir))
-        | 'PreprocessImages' >> beam.MapTuple(
-            lambda file_name, data: (file_name, preprocess_image(data))))
-    predictions = (
-        filename_value_pair
-        | 'PyTorchRunInference' >> RunInference(model_handler)
-        | 'ProcessOutput' >> beam.ParDo(PostProcessor()))
-
-    if known_args.output:
-      predictions | "WriteOutputToGCS" >> beam.io.WriteToText( # pylint: 
disable=expression-not-assigned
-        known_args.output,
-        shard_name_template='',
-        append_trailing_newlines=True)
+  if not test_pipeline:

Review Comment:
   This test_pipeline comes from the `load_test` and after the pipeline is ran, 
the test_pipeline object is used in the `load_test` to publish metrics. So I 
need its state to be preserved through out the E2E test. That's why I passed it 
as an argument to the example. 
   
   



-- 
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]

Reply via email to