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/08 21:13:46 UTC

[GitHub] [beam] yeandy opened a new pull request, #21758: Add README for image classification example

yeandy opened a new pull request, #21758:
URL: https://github.com/apache/beam/pull/21758

   Instructions on how to run a Pytorch RunInference example.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [ ] Add a link to the appropriate issue in your description, if applicable. This will automatically link the pull request to the issue.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


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


[GitHub] [beam] TheNeuralBit merged pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
TheNeuralBit merged PR #21758:
URL: https://github.com/apache/beam/pull/21758


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


[GitHub] [beam] ryanthompson591 commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
ryanthompson591 commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r892890839


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 

Review Comment:
   This sentence needs to be fixed.



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your

Review Comment:
   Maybe move this up to a torch dep section.



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:

Review Comment:
   Not all users will be using pytorch. Maybe change this sentence to:
   To use pytorch, first install pytorch:



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your
+pipeline with the following command-line option:
+```
+--requirements_file requirements.txt
+```
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Data
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines:
+
+<!---
+Add once benchmark test is released
+- `gs://apache-beam-ml/testing/inputs/it_mobilenetv2_imagenet_validation_inputs.txt`:
+  text file containing the GCS paths of the images of all 5000 imagenet validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00050000.JPEG
+-->
+- `gs://apache-beam-ml/testing/inputs/imagenet_validation_inputs.txt/`:
+  text file containing the GCS paths of the images of a subset of 15 imagenet
+  validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000015.JPEG
+
+- `gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_*.JPEG`:
+  JPEG images for the entire validation dataset.
+
+- `gs://apache-beam-ml/models/imagenet_classification_mobilenet_v2.pt`: Path to
+  the location of the saved state_dict of the pretrained mobilenet_v2 model
+  from the `torchvision.models` subdirectory.
+
+### Running `pytorch_image_classification.py`
+
+To run the image classification pipeline locally, use the following command:
+```sh
+python -m apache_beam.examples.inference.pytorch_image_classification \
+  --input gs://apache-beam-ml/testing/inputs/it_mobilenetv2_imagenet_validation_inputs.txt \
+  --output predictions.csv \
+  --model_state_dict_path gs://apache-beam-ml/models/imagenet_classification_mobilenet_v2.pt
+```
+
+This will write the output to the `predictions.csv` with contents like:
+```
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005002.JPEG,333
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005003.JPEG,711
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005004.JPEG,286
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005005.JPEG,433

Review Comment:
   3 or 4 lines should be adequate.



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your
+pipeline with the following command-line option:
+```
+--requirements_file requirements.txt
+```
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Data
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines:
+
+<!---
+Add once benchmark test is released
+- `gs://apache-beam-ml/testing/inputs/it_mobilenetv2_imagenet_validation_inputs.txt`:
+  text file containing the GCS paths of the images of all 5000 imagenet validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00050000.JPEG
+-->
+- `gs://apache-beam-ml/testing/inputs/imagenet_validation_inputs.txt/`:
+  text file containing the GCS paths of the images of a subset of 15 imagenet
+  validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000015.JPEG
+
+- `gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_*.JPEG`:
+  JPEG images for the entire validation dataset.
+
+- `gs://apache-beam-ml/models/imagenet_classification_mobilenet_v2.pt`: Path to
+  the location of the saved state_dict of the pretrained mobilenet_v2 model
+  from the `torchvision.models` subdirectory.
+
+### Running `pytorch_image_classification.py`
+
+To run the image classification pipeline locally, use the following command:
+```sh
+python -m apache_beam.examples.inference.pytorch_image_classification \
+  --input gs://apache-beam-ml/testing/inputs/it_mobilenetv2_imagenet_validation_inputs.txt \
+  --output predictions.csv \
+  --model_state_dict_path gs://apache-beam-ml/models/imagenet_classification_mobilenet_v2.pt
+```
+
+This will write the output to the `predictions.csv` with contents like:
+```
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005002.JPEG,333
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005003.JPEG,711
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005004.JPEG,286
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005005.JPEG,433
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005006.JPEG,290
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005007.JPEG,890
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005008.JPEG,592
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005009.JPEG,406
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005010.JPEG,996
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005011.JPEG,327
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005012.JPEG,573
+```
+where the second item in each line is the integer representing the predicted class of the
+image.

Review Comment:
   it would be cool if one of the ptransforms in the example joined to integer prediction to the actual name of the image.
   
   for example:
   gs://apache-beam-ml/datasets/.....5102.jpeg, horse
   gs://apache-beam-ml/datasets/.....5102.jpeg, cheese
   
   etc.
   
   But that is outside of the scope of this PR.
   



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your
+pipeline with the following command-line option:
+```
+--requirements_file requirements.txt
+```
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Data
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines:
+
+<!---
+Add once benchmark test is released

Review Comment:
   Is this a todo? Maybe add todo here if so.



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your
+pipeline with the following command-line option:
+```
+--requirements_file requirements.txt
+```
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Data
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines:

Review Comment:
   I don't know gs://apache-beam-ml will really work as a link or is right.
   
   maybe "staged in apache-beam-testing" will work
   
   Feel free to keep it this way if I'm just wrong or misunderstanding.
   
   Maybe this will link right if the users cloud account is set to apache-beam-testing.



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


[GitHub] [beam] yeandy commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894686332


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).

Review Comment:
   Is that link accessible to only Google employees though? would `https://console.cloud.google.com/` be better?



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


[GitHub] [beam] TheNeuralBit commented on pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on PR #21758:
URL: https://github.com/apache/beam/pull/21758#issuecomment-1152645969

   Merging despite the failed test since this is just a docs change.


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


[GitHub] [beam] yeandy commented on pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on PR #21758:
URL: https://github.com/apache/beam/pull/21758#issuecomment-1150421402

   R: @ryanthompson591 @AnandInguva 


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


[GitHub] [beam] yeandy commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894710084


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).
+```
+gsutil ls gs://apache-beam-ml
+```
+
+---
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Dataset and model for Image Classification
+
+<!---
+TODO: Add once benchmark test is released
+- `gs://apache-beam-ml/testing/inputs/imagenet_validation_inputs.txt`:
+  text file containing the GCS paths of the images of all 5000 imagenet validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00050000.JPEG
+-->
+- `gs://apache-beam-ml/testing/inputs/it_imagenet_validation_inputs.txt/`:

Review Comment:
   Fixed.



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).

Review Comment:
   Done.



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


[GitHub] [beam] TheNeuralBit commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894692660


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).

Review Comment:
   whoops, yes it would. I copied the wrong thing :)



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


[GitHub] [beam] tvalentyn commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
tvalentyn commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894786681


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency on a distributed runner, like Dataflow, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)

Review Comment:
   is this a leftover?



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


[GitHub] [beam] asf-ci commented on pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
asf-ci commented on PR #21758:
URL: https://github.com/apache/beam/pull/21758#issuecomment-1150421235

   Can one of the admins verify this patch?


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


[GitHub] [beam] yeandy commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894645866


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:

Review Comment:
   Fixed



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 

Review Comment:
   Fixed.



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


[GitHub] [beam] yeandy commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894645665


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your
+pipeline with the following command-line option:
+```
+--requirements_file requirements.txt
+```
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Data
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines:
+
+<!---
+Add once benchmark test is released

Review Comment:
   Yup, fixed



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


[GitHub] [beam] TheNeuralBit commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894693056


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).

Review Comment:
   https://console.cloud.google.com/storage/browser/apache-beam-ml



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


[GitHub] [beam] asf-ci commented on pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
asf-ci commented on PR #21758:
URL: https://github.com/apache/beam/pull/21758#issuecomment-1150421228

   Can one of the admins verify this patch?


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


[GitHub] [beam] yeandy commented on pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on PR #21758:
URL: https://github.com/apache/beam/pull/21758#issuecomment-1152482359

   I have another PR https://github.com/apache/beam/pull/21766, and once that gets merged I can add instructions for it in the README.md as well.


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


[GitHub] [beam] yeandy commented on pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on PR #21758:
URL: https://github.com/apache/beam/pull/21758#issuecomment-1152484348

   R: @tvalentyn @TheNeuralBit 


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


[GitHub] [beam] yeandy commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894633868


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your
+pipeline with the following command-line option:
+```
+--requirements_file requirements.txt
+```
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Data
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines:

Review Comment:
   It's not intended to be a link, but rather to show the location of datasets, models, etc. related to RunInference. The `apache-beam-ml` bucket is public; outside users should be able to view (with command `gsutil ls gs://apache-beam-ml`) and read these models / datasets with no issue?



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


[GitHub] [beam] TheNeuralBit commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894699278


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).

Review Comment:
   ```suggestion
   For installation of the `torch` dependency on a distributed runner, like Dataflow, refer to these
   [instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
   ```



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


[GitHub] [beam] TheNeuralBit commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894706601


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).

Review Comment:
   (Doesn't need to be exactly that text, just in general Beam docs should mention Dataflow as _a_ distributed runner and be clear that there are others)



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


[GitHub] [beam] TheNeuralBit commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894667985


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).

Review Comment:
   (optional) maybe link to the cloud console here: https://pantheon.corp.google.com/storage/browser/apache-beam-ml



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).
+```
+gsutil ls gs://apache-beam-ml
+```
+
+---
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Dataset and model for Image Classification
+
+<!---
+TODO: Add once benchmark test is released
+- `gs://apache-beam-ml/testing/inputs/imagenet_validation_inputs.txt`:
+  text file containing the GCS paths of the images of all 5000 imagenet validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00050000.JPEG
+-->
+- `gs://apache-beam-ml/testing/inputs/it_imagenet_validation_inputs.txt/`:

Review Comment:
   ```suggestion
   - `gs://apache-beam-ml/testing/inputs/it_imagenet_validation_inputs.txt`:
   ```



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).
+```
+gsutil ls gs://apache-beam-ml
+```
+
+---
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Dataset and model for Image Classification
+
+<!---
+TODO: Add once benchmark test is released
+- `gs://apache-beam-ml/testing/inputs/imagenet_validation_inputs.txt`:
+  text file containing the GCS paths of the images of all 5000 imagenet validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00050000.JPEG
+-->
+- `gs://apache-beam-ml/testing/inputs/it_imagenet_validation_inputs.txt/`:
+  text file containing the GCS paths of the images of a subset of 15 imagenet
+  validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000015.JPEG

Review Comment:
   (optional) It might be nice to clarify that these sub-bullets are the file contents with something like:
   ```sh
   $ gsutil cat gs://apache-beam-ml/testing/inputs/it_imagenet_validation_inputs.txt
   gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
   ...
   gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000015.JPEG
   ```



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


[GitHub] [beam] codecov[bot] commented on pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #21758:
URL: https://github.com/apache/beam/pull/21758#issuecomment-1152501044

   # [Codecov](https://codecov.io/gh/apache/beam/pull/21758?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#21758](https://codecov.io/gh/apache/beam/pull/21758?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ea6bb24) into [master](https://codecov.io/gh/apache/beam/commit/cd966ec35b6e534f11f1053f0846ae4e2dd25956?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (cd966ec) will **increase** coverage by `0.03%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #21758      +/-   ##
   ==========================================
   + Coverage   74.02%   74.06%   +0.03%     
   ==========================================
     Files         698      698              
     Lines       92192    92333     +141     
   ==========================================
   + Hits        68248    68386     +138     
   - Misses      22693    22696       +3     
     Partials     1251     1251              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | python | `83.63% <ø> (+0.03%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/beam/pull/21758?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...eam/transforms/py\_dataflow\_distribution\_counter.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy9weV9kYXRhZmxvd19kaXN0cmlidXRpb25fY291bnRlci5weQ==) | `91.42% <0.00%> (-4.87%)` | :arrow_down: |
   | [sdks/python/apache\_beam/dataframe/io.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vZGF0YWZyYW1lL2lvLnB5) | `88.78% <0.00%> (-3.26%)` | :arrow_down: |
   | [...python/apache\_beam/runners/worker/worker\_status.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvd29ya2VyX3N0YXR1cy5weQ==) | `78.26% <0.00%> (-1.45%)` | :arrow_down: |
   | [sdks/python/apache\_beam/utils/counters.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdXRpbHMvY291bnRlcnMucHk=) | `85.39% <0.00%> (-1.36%)` | :arrow_down: |
   | [...hon/apache\_beam/runners/worker/bundle\_processor.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvYnVuZGxlX3Byb2Nlc3Nvci5weQ==) | `93.67% <0.00%> (+0.12%)` | :arrow_up: |
   | [sdks/python/apache\_beam/transforms/window.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy93aW5kb3cucHk=) | `87.20% <0.00%> (+0.15%)` | :arrow_up: |
   | [...ks/python/apache\_beam/runners/worker/sdk\_worker.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvc2RrX3dvcmtlci5weQ==) | `89.09% <0.00%> (+0.15%)` | :arrow_up: |
   | [sdks/python/apache\_beam/utils/windowed\_value.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdXRpbHMvd2luZG93ZWRfdmFsdWUucHk=) | `92.52% <0.00%> (+0.17%)` | :arrow_up: |
   | [sdks/python/apache\_beam/transforms/core.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy9jb3JlLnB5) | `92.38% <0.00%> (+0.23%)` | :arrow_up: |
   | [...ks/python/apache\_beam/runners/worker/operations.py](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvb3BlcmF0aW9ucy5weQ==) | `74.32% <0.00%> (+0.29%)` | :arrow_up: |
   | ... and [9 more](https://codecov.io/gh/apache/beam/pull/21758/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/beam/pull/21758?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/beam/pull/21758?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [cd966ec...ea6bb24](https://codecov.io/gh/apache/beam/pull/21758?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [beam] yeandy commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894709876


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).

Review Comment:
   Thanks, fixed.



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,111 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+```
+pip install apache-beam==2.40.0
+```
+
+### Pytorch dependencies
+The RunInference API has support for the Pytorch framework. To use Pytorch locally, first install `torch`.
+```
+pip install torch==1.11.0
+```
+
+For installation of the `torch` dependency for Dataflow pipelines, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+### Datasets and Models for RunInference
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines. You can see this by using the [gsutil tool](https://cloud.google.com/storage/docs/gsutil#gettingstarted).
+```
+gsutil ls gs://apache-beam-ml
+```
+
+---
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Dataset and model for Image Classification
+
+<!---
+TODO: Add once benchmark test is released
+- `gs://apache-beam-ml/testing/inputs/imagenet_validation_inputs.txt`:
+  text file containing the GCS paths of the images of all 5000 imagenet validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00050000.JPEG
+-->
+- `gs://apache-beam-ml/testing/inputs/it_imagenet_validation_inputs.txt/`:
+  text file containing the GCS paths of the images of a subset of 15 imagenet
+  validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000015.JPEG

Review Comment:
   Added.



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


[GitHub] [beam] yeandy commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894648891


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your

Review Comment:
   Reworded a bunch



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


[GitHub] [beam] yeandy commented on a diff in pull request #21758: Add README for image classification example

Posted by GitBox <gi...@apache.org>.
yeandy commented on code in PR #21758:
URL: https://github.com/apache/beam/pull/21758#discussion_r894645154


##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your
+pipeline with the following command-line option:
+```
+--requirements_file requirements.txt
+```
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Data
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines:
+
+<!---
+Add once benchmark test is released
+- `gs://apache-beam-ml/testing/inputs/it_mobilenetv2_imagenet_validation_inputs.txt`:
+  text file containing the GCS paths of the images of all 5000 imagenet validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00050000.JPEG
+-->
+- `gs://apache-beam-ml/testing/inputs/imagenet_validation_inputs.txt/`:
+  text file containing the GCS paths of the images of a subset of 15 imagenet
+  validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000015.JPEG
+
+- `gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_*.JPEG`:
+  JPEG images for the entire validation dataset.
+
+- `gs://apache-beam-ml/models/imagenet_classification_mobilenet_v2.pt`: Path to
+  the location of the saved state_dict of the pretrained mobilenet_v2 model
+  from the `torchvision.models` subdirectory.
+
+### Running `pytorch_image_classification.py`
+
+To run the image classification pipeline locally, use the following command:
+```sh
+python -m apache_beam.examples.inference.pytorch_image_classification \
+  --input gs://apache-beam-ml/testing/inputs/it_mobilenetv2_imagenet_validation_inputs.txt \
+  --output predictions.csv \
+  --model_state_dict_path gs://apache-beam-ml/models/imagenet_classification_mobilenet_v2.pt
+```
+
+This will write the output to the `predictions.csv` with contents like:
+```
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005002.JPEG,333
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005003.JPEG,711
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005004.JPEG,286
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005005.JPEG,433
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005006.JPEG,290
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005007.JPEG,890
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005008.JPEG,592
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005009.JPEG,406
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005010.JPEG,996
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005011.JPEG,327
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005012.JPEG,573
+```
+where the second item in each line is the integer representing the predicted class of the
+image.

Review Comment:
   I have that for a different example https://github.com/apache/beam/pull/21766



##########
sdks/python/apache_beam/examples/inference/README.md:
##########
@@ -0,0 +1,114 @@
+<!--
+    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.
+-->
+
+# Example RunInference API Pipelines
+
+This module contains example pipelines that use the Beam RunInference
+API. <!---TODO: Add link to full documentation on Beam website when it's published.-->
+
+## Pre-requisites
+
+You must have `apache-beam>=2.40.0` installed in order to run these pipelines,
+because the `apache_beam.examples.inference` module was added in that release.
+Using the RunInference API also `torch` to be installed. 
+
+To install for a local pipeline, run:
+```
+pip install apache-beam torch==1.11.0
+```
+
+To install for a Dataflow pipeline, refer to these
+[instructions](https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies).
+You'll need to add `torch` to a `requirements.txt` file, and then run your
+pipeline with the following command-line option:
+```
+--requirements_file requirements.txt
+```
+
+<!---
+TODO: Add link to full documentation on Beam website when it's published.
+
+i.e. "See the
+[documentation](https://beam.apache.org/documentation/dsls/dataframes/overview/#pre-requisites)
+for details."
+-->
+
+## Image Classification with ImageNet dataset
+
+[`pytorch_image_classification.py`](./pytorch_image_classification.py) contains
+an implementation for a RunInference pipeline thatpeforms image classification
+on [ImageNet dataset](https://www.image-net.org/) using the MobileNetV2
+architecture.
+
+The pipeline reads the images, performs basic preprocessing, passes them to the
+PyTorch implementation of RunInference, and then writes the predictions
+to a text file in GCS.
+
+### Data
+Data related to RunInference has been staged in
+`gs://apache-beam-ml/` for use with these example pipelines:
+
+<!---
+Add once benchmark test is released
+- `gs://apache-beam-ml/testing/inputs/it_mobilenetv2_imagenet_validation_inputs.txt`:
+  text file containing the GCS paths of the images of all 5000 imagenet validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00050000.JPEG
+-->
+- `gs://apache-beam-ml/testing/inputs/imagenet_validation_inputs.txt/`:
+  text file containing the GCS paths of the images of a subset of 15 imagenet
+  validation data
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000001.JPEG
+    - ...
+    - gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00000015.JPEG
+
+- `gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_*.JPEG`:
+  JPEG images for the entire validation dataset.
+
+- `gs://apache-beam-ml/models/imagenet_classification_mobilenet_v2.pt`: Path to
+  the location of the saved state_dict of the pretrained mobilenet_v2 model
+  from the `torchvision.models` subdirectory.
+
+### Running `pytorch_image_classification.py`
+
+To run the image classification pipeline locally, use the following command:
+```sh
+python -m apache_beam.examples.inference.pytorch_image_classification \
+  --input gs://apache-beam-ml/testing/inputs/it_mobilenetv2_imagenet_validation_inputs.txt \
+  --output predictions.csv \
+  --model_state_dict_path gs://apache-beam-ml/models/imagenet_classification_mobilenet_v2.pt
+```
+
+This will write the output to the `predictions.csv` with contents like:
+```
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005002.JPEG,333
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005003.JPEG,711
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005004.JPEG,286
+gs://apache-beam-ml/datasets/imagenet/raw-data/validation/ILSVRC2012_val_00005005.JPEG,433

Review Comment:
   Fixed.



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