AnandInguva commented on code in PR #25393: URL: https://github.com/apache/beam/pull/25393#discussion_r1101891253
########## sdks/python/apache_beam/examples/inference/pytorch_image_classification_with_side_inputs.py: ########## @@ -0,0 +1,205 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +""" +A pipeline that uses RunInference PTransform to perform image classification +and uses WatchFilePattern as side input to the RunInference PTransform. +WatchFilePattern is used to watch for a file updates matching the file_pattern +based on timestamps and emits latest model metadata, which is used in +RunInference API for the dynamic model updates without the need for stopping +the beam pipeline. + +This pipeline follows the pattern from +https://beam.apache.org/documentation/patterns/side-inputs/ + +This pipeline expects a PubSub topic as source, which emits an image +path(UTF-8 encoded) that is accessible by the pipeline. + +To run the example on DataflowRunner, + +python apache_beam/examples/inference/pytorch_image_classification_with_side_inputs.py # pylint: disable=line-too-long + --project=<your-project> + --re=<your-region> + --temp_location=<your-tmp-location> + --staging_location=<your-staging-location> + --runner=DataflowRunner + --streaming + --interval=10 + --num_workers=5 + --requirements_file=apache_beam/ml/inference/torch_tests_requirements.txt + --topic=<pubusb_topic> + --file_pattern=<glob_pattern> Review Comment: I added some information that would be relevant to this pipeline. -- 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]
