You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2022/09/13 18:36:19 UTC

[beam] 01/01: Add section to docs on resource hints/RunInference

This is an automated email from the ASF dual-hosted git repository.

damccorm pushed a commit to branch users/damccorm/resourceHintingInference
in repository https://gitbox.apache.org/repos/asf/beam.git

commit c7f94d4743ebfedd77a56f0b45e83498284e526b
Author: Danny McCormick <da...@google.com>
AuthorDate: Tue Sep 13 14:36:10 2022 -0400

    Add section to docs on resource hints/RunInference
---
 .../en/documentation/sdks/python-machine-learning.md    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/website/www/site/content/en/documentation/sdks/python-machine-learning.md b/website/www/site/content/en/documentation/sdks/python-machine-learning.md
index 7513090271a..1317d9f460b 100644
--- a/website/www/site/content/en/documentation/sdks/python-machine-learning.md
+++ b/website/www/site/content/en/documentation/sdks/python-machine-learning.md
@@ -109,6 +109,23 @@ with pipeline as p:
 
 Where `model_handler_A` and `model_handler_B` are the model handler setup code.
 
+#### Use Resource Hints for Different Model Requirements
+
+When using multiple models in a single pipeline, different models may have different memory or worker SKU requirements.
+Resource hints allow you to provide information to a runner about the compute resource requirements for each step in your
+pipeline. For example, the following snippet hints different requirements for RAM and hardware accelerator per RunInference call:
+
+```
+with pipeline as p:
+   data = p | 'Read' >> beam.ReadFromSource('a_source')
+   model_a_predictions = data | RunInference(<model_handler_A>).with_resource_hints(min_ram="20GB")
+   model_b_predictions = model_a_predictions | beam.Map(some_post_processing) | RunInference(<model_handler_B>).with_resource_hints(
+      min_ram="4GB",
+      accelerator="type:nvidia-tesla-k80;count:1;install-nvidia-driver")
+```
+
+For more information on resource hints, see [Resource hints](../runtime/resource-hints.md).
+
 ### Use a keyed ModelHandler
 
 If a key is attached to the examples, wrap the `KeyedModelHandler` around the `ModelHandler` object: