AWS sagemaker documentation change
Summary
Updated documentation links, corrected import paths, and added SDK version-specific deployment examples
Security assessment
Changes are routine documentation updates including link corrections, import path fixes, and added deployment examples. No security vulnerabilities, configurations, or features are mentioned or addressed in the changes.
Diff
diff --git a/sagemaker/latest/dg/how-it-works-modelbuilder-creation.md b/sagemaker/latest/dg/how-it-works-modelbuilder-creation.md index 90ef2b4eb..25a74b847 100644 --- a//sagemaker/latest/dg/how-it-works-modelbuilder-creation.md +++ b//sagemaker/latest/dg/how-it-works-modelbuilder-creation.md @@ -32 +32 @@ Preparing your model for deployment on a SageMaker AI endpoint requires multiple -`ModelBuilder` is a Python class that takes a framework model, such as XGBoost or PyTorch, or a user-specified inference specification and converts it into a deployable model. `ModelBuilder` provides a build function that generates the artifacts for deployment. The model artifact generated is specific to the model server, which you can also specify as one of the inputs. For more details about the `ModelBuilder` class, see [ModelBuilder](https://sagemaker.readthedocs.io/en/stable/api/inference/model_builder.html#sagemaker.serve.builder.model_builder.ModelBuilder). +`ModelBuilder` is a Python class that takes a framework model, such as XGBoost or PyTorch, or a user-specified inference specification and converts it into a deployable model. `ModelBuilder` provides a build function that generates the artifacts for deployment. The model artifact generated is specific to the model server, which you can also specify as one of the inputs. For more details about the `ModelBuilder` class, see [ModelBuilder](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_serve.html). @@ -41 +41 @@ The following diagram illustrates the overall model creation workflow when you u - from sagemaker.serve.builder.model_builder import ModelBuilder + from sagemaker.serve.model_builder import ModelBuilder @@ -90 +90 @@ When you supply sample input and output to `SchemaBuilder`, the schema builder g -For further details about `SchemaBuilder`, see [SchemaBuilder](https://sagemaker.readthedocs.io/en/stable/api/inference/model_builder.html#sagemaker.serve.builder.schema_builder.SchemaBuilder). +For further details about `SchemaBuilder`, see [SchemaBuilder](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_serve.html). @@ -166 +166 @@ The following sections explain in detail how to build your model with `ModelBuil -Providing your own inference code through `InferenceSpec` offers an additional layer of customization. With `InferenceSpec`, you can customize how the model is loaded and how it handles incoming inference requests, bypassing its default loading and inference handling mechanisms. This flexibility is particularly beneficial when working with non-standard models or custom inference pipelines. You can customize the `invoke` method to control how the model preprocesses and postprocesses incoming requests. The `invoke` method ensures that the model handles inference requests correctly. The following example uses `InferenceSpec` to generate a model with the HuggingFace pipeline. For further details about `InferenceSpec`, refer to the [InferenceSpec](https://sagemaker.readthedocs.io/en/stable/api/inference/model_builder.html#sagemaker.serve.spec.inference_spec.InferenceSpec). +Providing your own inference code through `InferenceSpec` offers an additional layer of customization. With `InferenceSpec`, you can customize how the model is loaded and how it handles incoming inference requests, bypassing its default loading and inference handling mechanisms. This flexibility is particularly beneficial when working with non-standard models or custom inference pipelines. You can customize the `invoke` method to control how the model preprocesses and postprocesses incoming requests. The `invoke` method ensures that the model handles inference requests correctly. The following example uses `InferenceSpec` to generate a model with the HuggingFace pipeline. For further details about `InferenceSpec`, refer to the [InferenceSpec](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_serve.html). @@ -209,0 +210,12 @@ Deploy your model with the model’s existing `deploy` method. In this step, Sag +SageMaker Python SDK v3 + + + + endpoint = model_builder.deploy( + endpoint_name="my-endpoint", + instance_type="ml.c6i.xlarge" + ) + +SageMaker Python SDK v2 (Legacy) + + @@ -217,0 +230,23 @@ If you want more fine-grained control over the endpoint resources assigned to yo +SageMaker Python SDK v3 + + + + resource_requirements = ResourceRequirements( + requests={ + "num_accelerators": 4, + "memory": 1024, + "copies": 1, + }, + limits={}, + ) + endpoint = model_builder.deploy( + endpoint_name="my-endpoint", + mode=Mode.SAGEMAKER_ENDPOINT, + endpoint_type=EndpointType.INFERENCE_COMPONENT_BASED, + resources=resource_requirements, + role_arn="role" + ) + +SageMaker Python SDK v2 (Legacy) + + @@ -267,0 +303,9 @@ Call the `deploy` function to deploy locally, as shown in the following snippet. +SageMaker Python SDK v3 + + + + local_endpoint = xgb_local_builder.deploy_local() + +SageMaker Python SDK v2 (Legacy) + +