You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by GitBox <gi...@apache.org> on 2020/03/09 09:04:37 UTC

[GitHub] [beam] kamilwu opened a new pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

kamilwu opened a new pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075
 
 
   
   ------------------------
   
   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`).
    - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, 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).
   
   Post-Commit Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   
   Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
   --- | --- | --- | --- | --- | --- | --- | ---
   Go | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/)
   Java | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/)
   Python | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/) | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Python2_PVR_Flink_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Python2_PVR_Flink_Cron/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python35_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python35_VR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/)
   XLang | --- | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/)
   
   Pre-Commit Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   
   --- |Java | Python | Go | Website
   --- | --- | --- | --- | ---
   Non-portable | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/) 
   Portable | --- | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/) | --- | ---
   
   See [.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md) for trigger phrase, status and link of all Jenkins jobs.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] aaltay commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
aaltay commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393365169
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   Beam does not have hooks for job start and job finish. One way to emulate those would be using an airflow wrapper to run some setup and cleanup tasks before and after a task. I do not believe we have a recommendation here but an example pattern might be useful (@rezarokni -- in case this will be a good pattern to add to the backlog.)
   
   For this version, it is probably fine to assume that the life cycle of the model will be managed by the user separately. For a next phase, we can try to build a graph similar to IOs (like BQ IO) to execute a certain setup and clean task in a single worker. (Although we cannot guarantee that it will not be retried)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395095960
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   SG - that definitely helps remove the ambiguity

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393777307
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   If only TensorFlow models are supported, we should say "deploy a TensorFlow model to the cloud."
   
   Also, does the cloud service to which you deploy the model have to be AI Platform? If so, we should say "deploy a TensorFlow model to AI Platform."

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393783135
 
 

 ##########
 File path: website/src/documentation/patterns/overview.md
 ##########
 @@ -38,6 +38,9 @@ Pipeline patterns demonstrate common Beam use cases. Pipeline patterns are based
 **Custom window patterns** - Patterns for windowing functions
 * [Using data to dynamically set session window gaps]({{ site.baseurl }}/documentation/patterns/custom-windows/#using-data-to-dynamically-set-session-window-gaps)
 
+**AI Platform integration patterns** - Patterns for Google AI Platform transforms
 
 Review comment:
   Use the full service name here: "Patterns for using the Google Cloud AI Platform Prediction"
   
   Make sure the the service name is consistent throughout the pattern. I noticed that sometimes it's "Google Cloud AI Platform Prediction service", "Google Cloud AI Platform Prediction", etc.
   
   I'd recommend using the full service name ("Google Cloud AI Platform Prediction") the first time its mentioned. Then, refer to the service with the shorthand "AI Platform Prediction". This way, you can use some shorthand but there's no ambiguity about the name of service.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393774898
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
 
 Review comment:
   Add a comma before "which" in "which contains predictions"

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393764367
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Once a machine learning model is deployed, prepare a list of instances to get predictions for. 
+
+Here is an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+The example creates `tf.train.BytesList` instances, thus it expects byte-like strings as input, but other data types, like `tf.train.FloatList` and `tf.train.Int64List`, are also supported by the transform. To send binary data, make sure that the name of an input ends in `_bytes`.
 
 Review comment:
   Basically, the input format is very easy: the transform expects a PCollection of `tf.train.Example` objects, which are pretty well-known in tensorflow world. But I agree that the information about sending binary data is not visible enough. I'll try to improve it. 
   
   > do you mean that we need to change l74 to something like:
   feature={name+'_bytes', value} for sending binary data to endpoint?
   
   Yes. It's a sign for the transform that data should be b64-encoded. In a request we'd have something like this:
   
   `
   "instances": [{"input_bytes": {"b64": "xxx"}}]
   `

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r392972669
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Once a machine learning model is deployed, prepare a list of instances to get predictions for. 
+
+Here is an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+The example creates `tf.train.BytesList` instances, thus it expects byte-like strings as input, but other data types, like `tf.train.FloatList` and `tf.train.Int64List`, are also supported by the transform. To send binary data, make sure that the name of an input ends in `_bytes`.
+
+Here is the code:
+
+{:.language-java}
+```java
+// Getting predictions is not yet available for Java. [BEAM-9501]
+```
+
+{:.language-py}
+```py
+import json
+
+import apache_beam as beam
+
+import tensorflow as tf
+from tfx_bsl.beam.run_inference import RunInference
+from tfx_bsl.proto import model_spec_pb2
+
+def convert_json_to_tf_example(json_obj):
+  dict_ = json.loads(json_obj)
+  for name, text in dict_.items():
+      value = tf.train.Feature(bytes_list=tf.train.BytesList(
+        value=[text.encode('utf-8')]))
+      feature = {name: value}
+      return tf.train.Example(features=tf.train.Features(feature=feature))
+
+with beam.Pipeline() as p:
+     _ = (p
+         | beam.io.ReadFromText('gs://my-bucket/samples.json')
+         | beam.Map(convert_json_to_tf_example)
+         | RunInference(
 
 Review comment:
   Yes. The transform uses this client library: https://github.com/googleapis/google-api-python-client. 
   
   > is there a plan to support gRPC in the future?
   
   As far as I know, there is no such plan at the moment

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393775656
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
 
 Review comment:
   "One of them can use a service endpoint."
   
   First state the inference you can do with the transform, then describe how to do it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-602733889
 
 
   Thanks, good to know there is an ongoing discussion. Please let me know if anything changes.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393778127
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Once a machine learning model is deployed, prepare a list of instances to get predictions for. 
+
+Here is an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
 
 Review comment:
   "and sends data to the service"
   
   "the service" is "AI Platform", right? We should state this explicitly.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
Ardagan commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r391114014
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use your cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+We are going to use [tfx_bsl](https://github.com/tensorflow/tfx-bsl) library which provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. In this section we are going to consider one of them that uses a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before we get started, we have to deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Let's show an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+Here is the code:
+
+{:.language-java}
+```java
+// Getting predictions is not available for Java.
 
 Review comment:
   We can create tracking Jira for this and add reference.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395094609
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
 
 Review comment:
   SG :)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393778967
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Once a machine learning model is deployed, prepare a list of instances to get predictions for. 
+
+Here is an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+The example creates `tf.train.BytesList` instances, thus it expects byte-like strings as input, but other data types, like `tf.train.FloatList` and `tf.train.Int64List`, are also supported by the transform. To send binary data, make sure that the name of an input ends in `_bytes`.
 
 Review comment:
   The first sentence of this paragraph is long and hard to follow. Consider splitting in up into two (or even three) shorter sentences.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395118686
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   In this case it's for receiving data. In other words, AI Platform Prediction exposes a service endpoint that can receive data. I'll clarify it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] limingxi commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
limingxi commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393378386
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Once a machine learning model is deployed, prepare a list of instances to get predictions for. 
+
+Here is an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+The example creates `tf.train.BytesList` instances, thus it expects byte-like strings as input, but other data types, like `tf.train.FloatList` and `tf.train.Int64List`, are also supported by the transform. To send binary data, make sure that the name of an input ends in `_bytes`.
 
 Review comment:
   I think it would be good to list all possible input formats and output formats here or somewhere else for reference. And for the last sentence, do you mean that we need to change l74 to something like: 
   feature={name+'_bytes', value} for sending binary data to endpoint?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395228316
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google Cloud AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use [Google Cloud AI Platform Prediction](https://cloud.google.com/ai-platform/prediction/docs/overview) to make predictions about new data from a cloud-hosted machine learning model.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library with a Beam PTransform called `RunInference`. `RunInference` is able to perform an inference that can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for every bunch of elements, sends a request to AI Platform Prediction. The transform produces a PCollection of type `PredictLog`, which contains predictions.
 
 Review comment:
   Nice. We should add the link to the page

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-601256532
 
 
   Staged:
   http://apache-beam-website-pull-requests.storage.googleapis.com/11075/documentation/patterns/ai-platform/index.html
   http://apache-beam-website-pull-requests.storage.googleapis.com/11075/documentation/patterns/overview/index.html

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395049430
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   Alright, but I'd rather keep this sentence: "only TensorFlow models are supported by the transform" anyway. AI Platform, unlike `RunInference`, doesn't only support TensorFlow models.  It's important to put an emphasis on that.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393774212
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
 
 Review comment:
   "able to perform two types of inference"
   
   I only see one type of inference discussed in this paragraph. If we're only addressing one type of inference here, then we don't need to mention that there's another type. A reader might expect there to be information on both types of inference.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395103262
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google Cloud AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use [Google Cloud AI Platform Prediction](https://cloud.google.com/ai-platform/prediction/docs/overview) to make predictions about new data from a cloud-hosted machine learning model.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library with a Beam PTransform called `RunInference`. `RunInference` is able to perform an inference that can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for every bunch of elements, sends a request to AI Platform Prediction. The transform produces a PCollection of type `PredictLog`, which contains predictions.
 
 Review comment:
   "for every bunch of elements, sends a request to AI Platform Prediction."
   
   I assume this refers to batching data to AI Platform. Is there away to configure how many elements are in the batch? I think the previous version of this paragraph stated that one request is sent per element.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393007213
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   I'm curious what others think about this. @aaltay @Ardagan 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395130073
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google Cloud AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use [Google Cloud AI Platform Prediction](https://cloud.google.com/ai-platform/prediction/docs/overview) to make predictions about new data from a cloud-hosted machine learning model.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library with a Beam PTransform called `RunInference`. `RunInference` is able to perform an inference that can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for every bunch of elements, sends a request to AI Platform Prediction. The transform produces a PCollection of type `PredictLog`, which contains predictions.
 
 Review comment:
   Is there another doc (or some source code) we can link to that describes how Beam handles the batch size? It's probably not worth adding the extra details to this pattern but it may be helpful to provide a link for more information.
   
   I also think we should use the term "batch" instead of "bunch" for additional clarity.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-601256589
 
 
   LGTM

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395071873
 
 

 ##########
 File path: website/src/documentation/patterns/overview.md
 ##########
 @@ -38,6 +38,9 @@ Pipeline patterns demonstrate common Beam use cases. Pipeline patterns are based
 **Custom window patterns** - Patterns for windowing functions
 * [Using data to dynamically set session window gaps]({{ site.baseurl }}/documentation/patterns/custom-windows/#using-data-to-dynamically-set-session-window-gaps)
 
+**AI Platform integration patterns** - Patterns for Google AI Platform transforms
 
 Review comment:
   Looks good. One minor comment: there are more Google Cloud AI Platform transforms. This pull request is just about Prediction, more patterns could be added later. So I'd stick with `Patterns for Google Cloud AI Platform transforms`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395100511
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   The new text says "`RunInference` is able to perform an inference that can use a service endpoint." Is the service endpoint for receiving data or sending requests? It might be helpful to clarify.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-598263989
 
 
   This looks great. I can give it an editorial pass, but I'll wait until we have a plan to move forward re: tfx_bsl.
   
   In the meantime, here are a couple suggestions for improving the write-up:
   - Avoid "we" pronouns wherever possible (same for "let's"). Many of these sentences can be rewritten without pronouns. For instance, "you have to make" can be simplified to just "make."
   - If a pronoun is necessary, use the second person "you" to talk directly to the reader.
   - Try to keep the opening paragraphs as short and succinct as possible. Consider breaking up long paragraphs into multiple, smaller ones. This makes it easier for readers to scan the doc.
   - Introduce the code sample by explaining what it does, rather than explaining afterwards.
   
   I put together a [checklist/template for Beam patterns](https://docs.google.com/document/d/1lawWkFPDYV9ORUZbLZUxTvjG6hunyxDdR4s3tvQi6G4/edit) if you want to take a look. The PR already looks good from a content perspective, so this is just for reference :)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393770423
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
 
 Review comment:
   Is AI Platform the "cloud-hosted machine learning model"?
   
   I think we can remove the last part ("within Beam's pipeline").

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-598192419
 
 
   I see. In that case, I'll be waiting for suggestions on how we should move forward with the documentation.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395146160
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google Cloud AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use [Google Cloud AI Platform Prediction](https://cloud.google.com/ai-platform/prediction/docs/overview) to make predictions about new data from a cloud-hosted machine learning model.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library with a Beam PTransform called `RunInference`. `RunInference` is able to perform an inference that can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for every bunch of elements, sends a request to AI Platform Prediction. The transform produces a PCollection of type `PredictLog`, which contains predictions.
 
 Review comment:
   I believe BatchElements (the transform responsible for batching here) doc is sufficient. Here's a [link](https://github.com/apache/beam/blob/42d79c29949725b3afabfb3754bfb394be594460/sdks/python/apache_beam/transforms/util.py#L540)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395113820
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google Cloud AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use [Google Cloud AI Platform Prediction](https://cloud.google.com/ai-platform/prediction/docs/overview) to make predictions about new data from a cloud-hosted machine learning model.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library with a Beam PTransform called `RunInference`. `RunInference` is able to perform an inference that can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for every bunch of elements, sends a request to AI Platform Prediction. The transform produces a PCollection of type `PredictLog`, which contains predictions.
 
 Review comment:
   >  Is there away to configure how many elements are in the batch?
   
   No, in this case Beam handles the size of a batch on its own.
   
   > I think the previous version of this paragraph stated that one request is sent per element.
   
   That's right. After a discussion on batching it comes to my mind this is not truly correct.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393365839
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   LGTM

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-602645343
 
 
   > Maybe we need to wait until tfx_bsl is available as a public solution. @yifanmai @katsiapis -- please advise on when/how we should move forward.
   
   Pinging again. @aaltay @yifanmai @katsiapis 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r392966450
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
 
 Review comment:
   Offline inference from a SavedModel instance. I decided it's not worth mentioning here, since the article is focused on AI Platform patterns.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] aaltay commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
aaltay commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-602713546
 
 
   > > Maybe we need to wait until tfx_bsl is available as a public solution. @yifanmai @katsiapis -- please advise on when/how we should move forward.
   > 
   > Pinging again. @aaltay @yifanmai @katsiapis
   
   Still an open question in active discussion within TFX group. I am guessing decision, and the changes on TFX will take some time.
   
   And /cc @rose-rong-liu

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393146109
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   I am also curious about the best practice in similar scenarios for Beam customers. When they need to setup something, which can take about 10 minutes, do they normally do that setup manually or as part of pipeline.
   
   For up-deploy, we are considering autoscaling down to 0 when batch job is done, then customers don't need to do that un-deploy manually, neither we need to figure out the Beam clean-up phase.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393005385
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   Yes, the transform expects that a specified model is up and running. Users should also un-deploy redundant model manually.
   
   It is theoretically possible to implement such initial setup and clean-up operations, however, I wonder whether this is a good use-case for Beam: those are long-running operations and we'd have to wait until they are finished. As a result, Dataflow workers (or any other runner) would be idle for some time.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r392549097
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
 
 Review comment:
   Does that mean users will need to separately deploy a model first? will it be a better user experience if some initial setup stage for Beam can call AI Platform prediction public API to deploy model and get the service endpoint? 
   
   Also, for batch inference scenario, model deployment is a one-off job, users then need to un-deploy models to avoid unnecessary charges. Should they do that separately, or is there a BEAM final stage we could plug in a API call to delete that model deployment? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] wenchenglu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
wenchenglu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-599803048
 
 
   Thanks for addressing my comments. These changes look good to me. I will ask another engineer from AI Platform prediction to do another pass.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
Ardagan commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-597743712
 
 
   @aaltay @soyrice 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r392548549
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
 
 Review comment:
   "one of them can use a service endpoint", just out of curiosity, what is the other type of inference

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] aaltay commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
aaltay commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-597922627
 
 
   According to https://github.com/tensorflow/tfx-bsl
   
   > This package is not intended for direct use by TFX users, and its APIs should be considered internal to TFX (therefore there is no backward or forward compatibility guarantee) unless otherwise remarked.
   
   Maybe we need to wait until tfx_bsl is available as a public solution. @yifanmai @katsiapis  -- please advise on when/how we should move forward.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395037728
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
 
 Review comment:
   Fair enough, this is an another evidence that this mention causes confusion. I'll remote it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r392549383
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Once a machine learning model is deployed, prepare a list of instances to get predictions for. 
+
+Here is an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+The example creates `tf.train.BytesList` instances, thus it expects byte-like strings as input, but other data types, like `tf.train.FloatList` and `tf.train.Int64List`, are also supported by the transform. To send binary data, make sure that the name of an input ends in `_bytes`.
+
+Here is the code:
+
+{:.language-java}
+```java
+// Getting predictions is not yet available for Java. [BEAM-9501]
+```
+
+{:.language-py}
+```py
+import json
+
+import apache_beam as beam
+
+import tensorflow as tf
+from tfx_bsl.beam.run_inference import RunInference
+from tfx_bsl.proto import model_spec_pb2
+
+def convert_json_to_tf_example(json_obj):
+  dict_ = json.loads(json_obj)
+  for name, text in dict_.items():
+      value = tf.train.Feature(bytes_list=tf.train.BytesList(
+        value=[text.encode('utf-8')]))
+      feature = {name: value}
+      return tf.train.Example(features=tf.train.Features(feature=feature))
+
+with beam.Pipeline() as p:
+     _ = (p
+         | beam.io.ReadFromText('gs://my-bucket/samples.json')
 
 Review comment:
   is this a single inference input item? or a set of items? FYI, I think AI Platform Prediction supports both. For the latter one, a single HTTP request will embed multiple input items, which might provide better throughput once AI Platform Prediction enables batching mode in their model server.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-598765679
 
 
   @soyrice thanks, those are very useful tips! I've pushed new changes, hope it looks even 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r392306737
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use your cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+We are going to use [tfx_bsl](https://github.com/tensorflow/tfx-bsl) library which provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. In this section we are going to consider one of them that uses a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before we get started, we have to deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Let's show an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+Here is the code:
+
+{:.language-java}
+```java
+// Getting predictions is not available for Java.
 
 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
wenchenglu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r392549961
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Once a machine learning model is deployed, prepare a list of instances to get predictions for. 
+
+Here is an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+The example creates `tf.train.BytesList` instances, thus it expects byte-like strings as input, but other data types, like `tf.train.FloatList` and `tf.train.Int64List`, are also supported by the transform. To send binary data, make sure that the name of an input ends in `_bytes`.
+
+Here is the code:
+
+{:.language-java}
+```java
+// Getting predictions is not yet available for Java. [BEAM-9501]
+```
+
+{:.language-py}
+```py
+import json
+
+import apache_beam as beam
+
+import tensorflow as tf
+from tfx_bsl.beam.run_inference import RunInference
+from tfx_bsl.proto import model_spec_pb2
+
+def convert_json_to_tf_example(json_obj):
+  dict_ = json.loads(json_obj)
+  for name, text in dict_.items():
+      value = tf.train.Feature(bytes_list=tf.train.BytesList(
+        value=[text.encode('utf-8')]))
+      feature = {name: value}
+      return tf.train.Example(features=tf.train.Features(feature=feature))
+
+with beam.Pipeline() as p:
+     _ = (p
+         | beam.io.ReadFromText('gs://my-bucket/samples.json')
+         | beam.Map(convert_json_to_tf_example)
+         | RunInference(
 
 Review comment:
   Is RunInference a HTTP call? is there a plan to support gRPC in the future?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r395033918
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
 
 Review comment:
   No, AI Platform is a service that manages cloud-hosted machine learning models.
   How about something like this?
   
   > This section shows how to use Google Cloud AI Platform Prediction  to make predictions about new data from a cloud-hosted machine learning model.
   
   I'll also put an url link to an overview of AI Platform Prediction. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r392991557
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
+
+Before getting started, deploy a machine learning model to the cloud. The cloud service manages the infrastructure needed to handle prediction requests in both efficient and scalable way. Only Tensorflow models are supported. For more information, see [Exporting a SavedModel for prediction](https://cloud.google.com/ai-platform/prediction/docs/exporting-savedmodel-for-prediction).
+
+Once a machine learning model is deployed, prepare a list of instances to get predictions for. 
+
+Here is an example of a pipeline that reads input instances from the file, converts JSON objects to `tf.train.Example` objects and sends data to the service. The content of a file can look like this:
+
+```
+{"input": "the quick brown"}
+{"input": "la bruja le"}
+``` 
+
+The example creates `tf.train.BytesList` instances, thus it expects byte-like strings as input, but other data types, like `tf.train.FloatList` and `tf.train.Int64List`, are also supported by the transform. To send binary data, make sure that the name of an input ends in `_bytes`.
+
+Here is the code:
+
+{:.language-java}
+```java
+// Getting predictions is not yet available for Java. [BEAM-9501]
+```
+
+{:.language-py}
+```py
+import json
+
+import apache_beam as beam
+
+import tensorflow as tf
+from tfx_bsl.beam.run_inference import RunInference
+from tfx_bsl.proto import model_spec_pb2
+
+def convert_json_to_tf_example(json_obj):
+  dict_ = json.loads(json_obj)
+  for name, text in dict_.items():
+      value = tf.train.Feature(bytes_list=tf.train.BytesList(
+        value=[text.encode('utf-8')]))
+      feature = {name: value}
+      return tf.train.Example(features=tf.train.Features(feature=feature))
+
+with beam.Pipeline() as p:
+     _ = (p
+         | beam.io.ReadFromText('gs://my-bucket/samples.json')
 
 Review comment:
   `RunInference` uses a Beam's built-in transform `BatchElements`, which batches elements (it means that it consumes a PCollection of `tf.train.Example` and produces a PCollection of `List[tf.train.Example]`). Thanks to that, multiple input items could be sent using a single HTTP request.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-596409186
 
 
   R: @Ardagan 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
soyrice commented on a change in pull request #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#discussion_r393773039
 
 

 ##########
 File path: website/src/documentation/patterns/ai-platform.md
 ##########
 @@ -0,0 +1,87 @@
+---
+layout: section
+title: "AI Platform integration patterns"
+section_menu: section-menu/documentation.html
+permalink: /documentation/patterns/ai-platform/
+---
+<!--
+Licensed 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.
+-->
+
+# AI Platform integration patterns
+
+This page describes common patterns in pipelines with Google AI Platform transforms.
+
+<nav class="language-switcher">
+  <strong>Adapt for:</strong>
+  <ul>
+    <li data-type="language-java">Java SDK</li>
+    <li data-type="language-py" class="active">Python SDK</li>
+  </ul>
+</nav>
+
+## Getting predictions
+
+This section shows how to use a cloud-hosted machine learning model to make predictions about new data using Google Cloud AI Platform Prediction within Beam's pipeline.
+ 
+[tfx_bsl](https://github.com/tensorflow/tfx-bsl) is a library that provides `RunInference` Beam's PTransform. `RunInference` is a PTransform able to perform two types of inference. One of them can use a service endpoint. When using a service endpoint, the transform takes a PCollection of type `tf.train.Example` and, for each element, sends a request to Google Cloud AI Platform Prediction service. The transform produces a PCollection of type `PredictLog` which contains predictions.
 
 Review comment:
   To avoid the phrase "Beam's PTransform", I'd recommend something like "is a library with a Beam PTransform called `RunInterface`".

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton

Posted by GitBox <gi...@apache.org>.
kamilwu commented on issue #11075: [BEAM-9421] Website section that describes getting predictions using AI Platform Prediciton
URL: https://github.com/apache/beam/pull/11075#issuecomment-601285520
 
 
   Thanks @soyrice for your in-depth review!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services