You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/09/13 21:01:52 UTC

[GitHub] [beam] liferoad opened a new pull request, #23218: updated the pydoc for running a custom model on Beam

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

   * Added some descriptions in pydoc to show how to run the inference using the custom models.
   
   @rezarokni 
   
   ------------------------
   
   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`).
    - [ ] 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] AnandInguva commented on a diff in pull request #23218: updated the pydoc for running a custom model on Beam

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


##########
website/www/site/content/en/documentation/sdks/python-machine-learning.md:
##########
@@ -83,6 +83,14 @@ You need to provide a path to a file that contains the pickled Scikit-learn mode
    `model_uri=<path_to_pickled_file>` and `model_file_type: <ModelFileType>`, where you can specify
    `ModelFileType.PICKLE` or `ModelFileType.JOBLIB`, depending on how the model was serialized.
 
+### Use custom models
+
+In fact, the RunInference API is designed flexibly to allow you to use any custom machine learning models. You only need to create your own `ModelHandler` or `KeyedModelHandler` to handle how the ML models are loaded from a location that the pipeline can access and how to use these models to run the inference. 
+
+A simple example can be found in [this notebook](https://github.com/apache/beam/blob/master/examples/notebooks/beam-ml/run_custom_inference.ipynb).
+The `load_model` method is created to load the models using a popular `spaCy` package while `run_inference` shows how to run the inference on a batch of examples.

Review Comment:
   ```suggestion
   The `load_model` method shows how to load the model using a popular `spaCy` package while `run_inference` shows how to run the inference on a batch of examples.
   ```



-- 
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 merged pull request #23218: updated the pydoc for running a custom model on Beam

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


-- 
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] AnandInguva commented on pull request #23218: updated the pydoc for running a custom model on Beam

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

   cc @damccorm 


-- 
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 #23218: updated the pydoc for running a custom model on Beam

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


##########
website/www/site/content/en/documentation/sdks/python-machine-learning.md:
##########
@@ -83,6 +83,14 @@ You need to provide a path to a file that contains the pickled Scikit-learn mode
    `model_uri=<path_to_pickled_file>` and `model_file_type: <ModelFileType>`, where you can specify
    `ModelFileType.PICKLE` or `ModelFileType.JOBLIB`, depending on how the model was serialized.
 
+### Use custom models
+
+In fact, the RunInference API is designed flexibly to allow you to use any custom machine learning models. You only need to create your own `ModelHandler` or `KeyedModelHandler` to handle how the ML models are loaded from a location that the pipeline can access and how to use these models to run the inference. 

Review Comment:
   ```suggestion
   If you would like to use a model that isn't specified by one of the supported frameworks, the RunInference API is designed flexibly to allow you to use any custom machine learning models.
   You only need to create your own `ModelHandler` or `KeyedModelHandler` with logic to load your model and use it to run the inference.
   ```
   
   Mostly a wording nit, but I'd also like to emphasize that this shouldn't be the default option (the default is using one of the existing model handlers). Ideally over time we will support enough frameworks that creating a custom model handler is no longer a common need at all, but in general we want to point people to our handlers first so that they get any improvements for free.



-- 
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] liferoad commented on a diff in pull request #23218: updated the pydoc for running a custom model on Beam

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


##########
website/www/site/content/en/documentation/sdks/python-machine-learning.md:
##########
@@ -83,6 +83,14 @@ You need to provide a path to a file that contains the pickled Scikit-learn mode
    `model_uri=<path_to_pickled_file>` and `model_file_type: <ModelFileType>`, where you can specify
    `ModelFileType.PICKLE` or `ModelFileType.JOBLIB`, depending on how the model was serialized.
 
+### Use custom models
+
+In fact, the RunInference API is designed flexibly to allow you to use any custom machine learning models. You only need to create your own `ModelHandler` or `KeyedModelHandler` to handle how the ML models are loaded from a location that the pipeline can access and how to use these models to run the inference. 

Review Comment:
   looks good. Thanks for rewording these.



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