You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "riteshghorse (via GitHub)" <gi...@apache.org> on 2023/04/28 15:13:17 UTC

[GitHub] [beam] riteshghorse opened a new pull request, #26472: [Python] Add saved_weights example to tf notebook

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

   Adds an example to demonstrate how to load a TF model from saved weights
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] 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/get-started-contributing/#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/workflows/Go%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] riteshghorse commented on pull request #26472: [Python] Add saved_weights example to tf notebook

Posted by "riteshghorse (via GitHub)" <gi...@apache.org>.
riteshghorse commented on PR #26472:
URL: https://github.com/apache/beam/pull/26472#issuecomment-1527718179

   R: @damccorm @rszper 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damccorm commented on a diff in pull request #26472: [Python] Add saved_weights example to tf notebook

Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm commented on code in PR #26472:
URL: https://github.com/apache/beam/pull/26472#discussion_r1180646421


##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -356,7 +332,7 @@
     {
       "cell_type": "markdown",
       "source": [
-        "Save the weights."
+        "Instead of saving the entire model, you can just save the model weights for inference. This is slightly lightweight than saving and loading the entire model. However, you need to pass the function to build TensorFlow model to the `TFModelHandlerNumpy` / `TFModelHandlerTensor` class along with `ModelType.SAVED_WEIGHTS`."

Review Comment:
   ```suggestion
           "Instead of saving the entire model, you can just [save the model weights for inference](https://www.tensorflow.org/guide/keras/save_and_serialize#saving_loading_only_the_models_weights_values). This creates a smaller artifact than saving and loading the entire model and allows the model to be more easily loaded on different architectures. However, to load the model you will need to pass the function to build TensorFlow model to the `TFModelHandlerNumpy` / `TFModelHandlerTensor` class along with `ModelType.SAVED_WEIGHTS`."
   ```
   
   Rethinking this, I actually think providing a little more guidance on why you might do this is helpful. Also, some wording nits



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] riteshghorse commented on a diff in pull request #26472: [Python] Add saved_weights example to tf notebook

Posted by "riteshghorse (via GitHub)" <gi...@apache.org>.
riteshghorse commented on code in PR #26472:
URL: https://github.com/apache/beam/pull/26472#discussion_r1180591557


##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -313,14 +350,34 @@
       "metadata": {
         "id": "2JbE7WkGcAkK"
       },
-      "execution_count": 8,
+      "execution_count": 18,
+      "outputs": []
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "Save the weights."

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] rszper commented on a diff in pull request #26472: [Python] Add saved_weights example to tf notebook

Posted by "rszper (via GitHub)" <gi...@apache.org>.
rszper commented on code in PR #26472:
URL: https://github.com/apache/beam/pull/26472#discussion_r1180635425


##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -73,10 +73,19 @@
         "\n",
         "If your model uses `tf.Example` as an input, see the [Apache Beam RunInference with `tfx-bsl`](https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_tensorflow_with_tfx.ipynb) notebook.\n",
         "\n",
+        "There are three ways to load a TensorFlow model:\n",
+        "1. Using a path to the saved model.\n",
+        "2. Using a path to the saved weights of model.\n",

Review Comment:
   ```suggestion
           "2. Provide a path to the saved weights of the model.\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -73,10 +73,19 @@
         "\n",
         "If your model uses `tf.Example` as an input, see the [Apache Beam RunInference with `tfx-bsl`](https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_tensorflow_with_tfx.ipynb) notebook.\n",
         "\n",
+        "There are three ways to load a TensorFlow model:\n",
+        "1. Using a path to the saved model.\n",
+        "2. Using a path to the saved weights of model.\n",
+        "3. Using a URL for pretrained model on TensorFlow Hub (See this [notebook](https://github.com/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_with_tensorflow_hub.ipynb))\n",

Review Comment:
   ```suggestion
           "3. Provide a URL for pretrained model on TensorFlow Hub. For an example workflow, see [Apache Beam RunInference with TensorFlow and TensorFlow Hub](https://github.com/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_with_tensorflow_hub.ipynb).\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -73,10 +73,19 @@
         "\n",
         "If your model uses `tf.Example` as an input, see the [Apache Beam RunInference with `tfx-bsl`](https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_tensorflow_with_tfx.ipynb) notebook.\n",
         "\n",
+        "There are three ways to load a TensorFlow model:\n",
+        "1. Using a path to the saved model.\n",
+        "2. Using a path to the saved weights of model.\n",
+        "3. Using a URL for pretrained model on TensorFlow Hub (See this [notebook](https://github.com/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_with_tensorflow_hub.ipynb))\n",
+        "\n",
         "This notebook demonstrates the following steps:\n",
         "- Build a simple TensorFlow model.\n",
         "- Set up example data.\n",
-        "- Run those examples with the built-in model handlers and get a prediction inside an Apache Beam pipeline.\n",
+        "- Run those examples with the built-in model handlers using:\n",
+        "  *   Saved Model\n",
+        "  *   Saved Weights\n",

Review Comment:
   ```suggestion
           "  *   saved weights\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -73,10 +73,19 @@
         "\n",
         "If your model uses `tf.Example` as an input, see the [Apache Beam RunInference with `tfx-bsl`](https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_tensorflow_with_tfx.ipynb) notebook.\n",
         "\n",
+        "There are three ways to load a TensorFlow model:\n",
+        "1. Using a path to the saved model.\n",
+        "2. Using a path to the saved weights of model.\n",
+        "3. Using a URL for pretrained model on TensorFlow Hub (See this [notebook](https://github.com/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_with_tensorflow_hub.ipynb))\n",
+        "\n",
         "This notebook demonstrates the following steps:\n",
         "- Build a simple TensorFlow model.\n",
         "- Set up example data.\n",
-        "- Run those examples with the built-in model handlers and get a prediction inside an Apache Beam pipeline.\n",
+        "- Run those examples with the built-in model handlers using:\n",
+        "  *   Saved Model\n",

Review Comment:
   ```suggestion
           "  *   a saved model\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -73,10 +73,19 @@
         "\n",
         "If your model uses `tf.Example` as an input, see the [Apache Beam RunInference with `tfx-bsl`](https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_tensorflow_with_tfx.ipynb) notebook.\n",
         "\n",
+        "There are three ways to load a TensorFlow model:\n",
+        "1. Using a path to the saved model.\n",

Review Comment:
   ```suggestion
           "1. Provide a path to the saved model.\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -73,10 +73,19 @@
         "\n",
         "If your model uses `tf.Example` as an input, see the [Apache Beam RunInference with `tfx-bsl`](https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_tensorflow_with_tfx.ipynb) notebook.\n",
         "\n",
+        "There are three ways to load a TensorFlow model:\n",
+        "1. Using a path to the saved model.\n",
+        "2. Using a path to the saved weights of model.\n",
+        "3. Using a URL for pretrained model on TensorFlow Hub (See this [notebook](https://github.com/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_with_tensorflow_hub.ipynb))\n",
+        "\n",
         "This notebook demonstrates the following steps:\n",
         "- Build a simple TensorFlow model.\n",
         "- Set up example data.\n",
-        "- Run those examples with the built-in model handlers and get a prediction inside an Apache Beam pipeline.\n",
+        "- Run those examples with the built-in model handlers using:\n",
+        "  *   Saved Model\n",
+        "  *   Saved Weights\n",
+        "\n",
+        "  and get a prediction inside an Apache Beam pipeline.\n",

Review Comment:
   If you make the change above, remove this line.



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -313,14 +326,34 @@
       "metadata": {
         "id": "2JbE7WkGcAkK"
       },
-      "execution_count": 8,
+      "execution_count": 18,
+      "outputs": []
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "Instead of saving the entire model, you can just save the model weights for inference. This is slightly lightweight than saving and loading the entire model. However, you need to pass the function to build TensorFlow model to the `TFModelHandlerNumpy` / `TFModelHandlerTensor` class along with `ModelType.SAVED_WEIGHTS`."
+      ],
+      "metadata": {
+        "id": "g_qVtXPeUcMS"
+      }
+    },
+    {
+      "cell_type": "code",
+      "source": [
+        "model.save_weights(save_weights_dir_multiply)"
+      ],
+      "metadata": {
+        "id": "Kl1C_NwaUbiv"
+      },
+      "execution_count": 19,
       "outputs": []
     },
     {
       "cell_type": "markdown",
       "source": [
         "## Run the pipeline\n",
-        "Use the following code to run the pipeline."
+        "#### Use the following code to run the pipeline by specifying path to the trained TensorFlow model."

Review Comment:
   ```suggestion
           "Use the following code to run the pipeline by specifying the path to the trained TensorFlow model."
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -209,36 +219,39 @@
           "base_uri": "https://localhost:8080/"
         },
         "id": "SH7iq3zeBBJ-",
-        "outputId": "e15cab6b-1271-4b0b-bac3-ba76f8991077"
+        "outputId": "5a3d3ce4-f9d8-4d87-a1bc-05afc3c9b06e"
       },
       "source": [
         "# Create training data that represents the 5 times multiplication table for the numbers 0 to 99.\n",
         "# x is the data and y is the labels.\n",
         "x = numpy.arange(0, 100)   # Examples\n",
         "y = x * 5                  # Labels\n",
         "\n",
-        "# Build a simple linear regression model.\n",
+        "# create_model builds a simple linear regression model.\n",

Review Comment:
   ```suggestion
           "# Use create_model to build a simple linear regression model.\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -395,10 +428,55 @@
           "output_type": "stream",
           "name": "stdout",
           "text": [
-            "example is 20.0 prediction is [51.815357]\n",
-            "example is 40.0 prediction is [101.63492]\n",
-            "example is 60.0 prediction is [151.45448]\n",
-            "example is 90.0 prediction is [226.18384]\n"
+            "example is 20.0 prediction is [21.896107]\n",
+            "example is 40.0 prediction is [41.795692]\n",
+            "example is 60.0 prediction is [61.69528]\n",
+            "example is 90.0 prediction is [91.544655]\n"
+          ]
+        }
+      ]
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "#### Use the following code to run the pipeline with the saved weights of a TensorFlow model.\n",

Review Comment:
   ```suggestion
           "Use the following code to run the pipeline with the saved weights of a TensorFlow model.\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -313,14 +326,34 @@
       "metadata": {
         "id": "2JbE7WkGcAkK"
       },
-      "execution_count": 8,
+      "execution_count": 18,
+      "outputs": []
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "Instead of saving the entire model, you can just save the model weights for inference. This is slightly lightweight than saving and loading the entire model. However, you need to pass the function to build TensorFlow model to the `TFModelHandlerNumpy` / `TFModelHandlerTensor` class along with `ModelType.SAVED_WEIGHTS`."

Review Comment:
   ```suggestion
           "Instead of saving the entire model, you can save the model weights for inference. This method might be simpler than saving and loading the entire model. However, you need to pass the function to build the TensorFlow model to the `TFModelHandlerNumpy` or `TFModelHandlerTensor` class, as well as `ModelType.SAVED_WEIGHTS`."
   ```
   
   A couple things are unclear to me from this sentence:
   1. Should this be "or" or "and": `TFModelHandlerNumpy` or `TFModelHandlerTensor` class
   2. Is `ModelType.SAVED_WEIGHTS` also being passed to `TFModelHandlerNumpy` or `TFModelHandlerTensor`? We should make whatever is happening with `ModelType.SAVED_WEIGHTS` a new sentence and be clear about what we're doing with it.



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -73,10 +73,19 @@
         "\n",
         "If your model uses `tf.Example` as an input, see the [Apache Beam RunInference with `tfx-bsl`](https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_tensorflow_with_tfx.ipynb) notebook.\n",
         "\n",
+        "There are three ways to load a TensorFlow model:\n",
+        "1. Using a path to the saved model.\n",
+        "2. Using a path to the saved weights of model.\n",
+        "3. Using a URL for pretrained model on TensorFlow Hub (See this [notebook](https://github.com/apache/beam/blob/master/examples/notebooks/beam-ml/run_inference_with_tensorflow_hub.ipynb))\n",
+        "\n",
         "This notebook demonstrates the following steps:\n",
         "- Build a simple TensorFlow model.\n",
         "- Set up example data.\n",
-        "- Run those examples with the built-in model handlers and get a prediction inside an Apache Beam pipeline.\n",
+        "- Run those examples with the built-in model handlers using:\n",

Review Comment:
   ```suggestion
           "- Run those examples with the built-in model handlers using one of the following methods, and then get a prediction inside an Apache Beam pipeline.\n",
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] rszper commented on a diff in pull request #26472: [Python] Add saved_weights example to tf notebook

Posted by "rszper (via GitHub)" <gi...@apache.org>.
rszper commented on code in PR #26472:
URL: https://github.com/apache/beam/pull/26472#discussion_r1180769310


##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -332,7 +330,16 @@
     {
       "cell_type": "markdown",
       "source": [
-        "Instead of saving the entire model, you can just save the model weights for inference. This is slightly lightweight than saving and loading the entire model. However, you need to pass the function to build TensorFlow model to the `TFModelHandlerNumpy` / `TFModelHandlerTensor` class along with `ModelType.SAVED_WEIGHTS`."
+        "Instead of saving the entire model, you can just [save the model weights for inference](https://www.tensorflow.org/guide/keras/save_and_serialize#saving_loading_only_the_models_weights_values). This is useful in cases when you're using the model just for inference and won't need any compilation information or optimizer state. This also allows loading the weights with new model in case of transfer learning applications.\n",

Review Comment:
   ```suggestion
           "Instead of saving the entire model, you can [save the model weights for inference](https://www.tensorflow.org/guide/keras/save_and_serialize#saving_loading_only_the_models_weights_values). You can use this method when you need the model for inference but don't need any compilation information or optimizer state. In addition, when using transfer learning applications, you can use this method to load the weights with new models.\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -332,7 +330,16 @@
     {
       "cell_type": "markdown",
       "source": [
-        "Instead of saving the entire model, you can just save the model weights for inference. This is slightly lightweight than saving and loading the entire model. However, you need to pass the function to build TensorFlow model to the `TFModelHandlerNumpy` / `TFModelHandlerTensor` class along with `ModelType.SAVED_WEIGHTS`."
+        "Instead of saving the entire model, you can just [save the model weights for inference](https://www.tensorflow.org/guide/keras/save_and_serialize#saving_loading_only_the_models_weights_values). This is useful in cases when you're using the model just for inference and won't need any compilation information or optimizer state. This also allows loading the weights with new model in case of transfer learning applications.\n",
+        "\n",
+        "With this approach, you need to pass the function to build TensorFlow model to the `TFModelHandler` class you intend to use (`TFModelHandlerNumpy` / `TFModelHandlerTensor`)  along with `model_type=ModelType.SAVED_WEIGHTS`.\n",

Review Comment:
   ```suggestion
           "With this approach, you need to pass the function to build the TensorFlow model to the `TFModelHandler` class that you're using, either`TFModelHandlerNumpy` or `TFModelHandlerTensor`. You also need to pass `model_type=ModelType.SAVED_WEIGHTS` to the class.\n",
   ```



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -332,7 +330,16 @@
     {
       "cell_type": "markdown",
       "source": [
-        "Instead of saving the entire model, you can just save the model weights for inference. This is slightly lightweight than saving and loading the entire model. However, you need to pass the function to build TensorFlow model to the `TFModelHandlerNumpy` / `TFModelHandlerTensor` class along with `ModelType.SAVED_WEIGHTS`."
+        "Instead of saving the entire model, you can just [save the model weights for inference](https://www.tensorflow.org/guide/keras/save_and_serialize#saving_loading_only_the_models_weights_values). This is useful in cases when you're using the model just for inference and won't need any compilation information or optimizer state. This also allows loading the weights with new model in case of transfer learning applications.\n",
+        "\n",
+        "With this approach, you need to pass the function to build TensorFlow model to the `TFModelHandler` class you intend to use (`TFModelHandlerNumpy` / `TFModelHandlerTensor`)  along with `model_type=ModelType.SAVED_WEIGHTS`.\n",

Review Comment:
   I took a stab at updating this, but please verify that what I wrote is technically accurate.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #26472: [Python] Add saved_weights example to tf notebook

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26472:
URL: https://github.com/apache/beam/pull/26472#issuecomment-1527719515

   Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] riteshghorse merged pull request #26472: [Python] Add saved_weights example to tf notebook

Posted by "riteshghorse (via GitHub)" <gi...@apache.org>.
riteshghorse merged PR #26472:
URL: https://github.com/apache/beam/pull/26472


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damccorm commented on a diff in pull request #26472: [Python] Add saved_weights example to tf notebook

Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm commented on code in PR #26472:
URL: https://github.com/apache/beam/pull/26472#discussion_r1180544965


##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -101,20 +110,44 @@
         "To use RunInference with the built-in Tensorflow model handler, install Apache Beam version 2.46.0 or later."
       ],
       "metadata": {
-        "id": "gVCtGOKTHMm4"
+        "id": "YDHPlMjZRuY0"
       }
     },
     {
       "cell_type": "code",
       "metadata": {
-        "id": "jBakpNZnAhqk"
+        "id": "jBakpNZnAhqk",
+        "colab": {
+          "base_uri": "https://localhost:8080/"
+        },
+        "outputId": "375cd47b-b837-4091-88e2-cdac12e3a4a1"
       },
       "source": [
         "!pip install protobuf --quiet\n",
         "!pip install apache_beam==2.46.0 --quiet"
       ],
-      "execution_count": null,
-      "outputs": []
+      "execution_count": 1,
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m14.2/14.2 MB\u001b[0m \u001b[31m24.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
+            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m152.0/152.0 kB\u001b[0m \u001b[31m12.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
+            "\u001b[?25h  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
+            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m135.6/135.6 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
+            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.7/2.7 MB\u001b[0m \u001b[31m51.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
+            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m516.2/516.2 kB\u001b[0m \u001b[31m14.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
+            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.6/2.6 MB\u001b[0m \u001b[31m53.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
+            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m89.7/89.7 kB\u001b[0m \u001b[31m5.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
+            "\u001b[?25h  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
+            "  Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
+            "  Building wheel for crcmod (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
+            "  Building wheel for dill (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
+            "  Building wheel for docopt (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
+          ]
+        }
+      ]

Review Comment:
   ```suggestion
         "execution_count": null,
         "outputs": []
   ```
   
   Lets drop this output for the sake of a cleaner notebook



##########
examples/notebooks/beam-ml/run_inference_tensorflow.ipynb:
##########
@@ -313,14 +350,34 @@
       "metadata": {
         "id": "2JbE7WkGcAkK"
       },
-      "execution_count": 8,
+      "execution_count": 18,
+      "outputs": []
+    },
+    {
+      "cell_type": "markdown",
+      "source": [
+        "Save the weights."

Review Comment:
   Maybe something along the lines of: `Instead of saving the model, you can also save/load a model using just the model weights and class. This is a smaller, more efficient way to represent your model.`
   
   Basically, I want something to justify to the user why we're having them save things 2 ways so they know that in reality they just have to pick one.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org