Serverless inference tutorial using sagemaker sdk - #2639
Conversation
Signed-off-by: DWarez <dario.salvati@huggingface.co>
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Signed-off-by: DWarez <dario.salvati@huggingface.co>
Signed-off-by: DWarez <dario.salvati@huggingface.co>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b857108. Configure here.
| "def ignore_not_found(error):\n", | ||
| " code = error.response.get(\"Error\", {}).get(\"Code\", \"\")\n", | ||
| " message = error.response.get(\"Error\", {}).get(\"Message\", \"\")\n", | ||
| " return code in {\"ResourceNotFound\", \"ResourceNotFoundException\"} or \"not exist\" in message\n", |
There was a problem hiding this comment.
Missed SageMaker not-found errors
Low Severity
ignore_not_found only treats ResourceNotFound / ResourceNotFoundException or messages containing not exist as missing resources. SageMaker delete calls for endpoints, configs, and models often raise ValidationException with a Could not find … message, which this helper treats as fatal and re-raises.
Reviewed by Cursor Bugbot for commit b857108. Configure here.
change: more precise phrasing regarding costs Signed-off-by: DWarez <dario.salvati@huggingface.co>


Note
Low Risk
Documentation-only addition (Jupyter notebook); no production code or SDK behavior changes.
Overview
Adds a new SageMaker SDK v3 tutorial notebook under
docs/sagemaker/notebooks/sagemaker-sdk/serverless-inference-embedding-tei/that walks through serverless (scale-to-zero) inference for a low-traffic semantic-search use case.The notebook explains when serverless fits vs provisioned real-time endpoints, then deploys
BAAI/bge-small-en-v1.5with the TEI CPU container viaModelBuilderandServerlessInferenceConfig(memory, max concurrency, optional provisioned concurrency) instead of aninstance_type. It covers session/role setup, env-driven sizing, invocation with cold vs warm latency timing, a matplotlib bar chart of cold-start overhead, a cosine-similarity retrieval smoke test, and optional cleanup of endpoint, config, and model resources.Reviewed by Cursor Bugbot for commit 059a64e. Bugbot is set up for automated code reviews on this repo. Configure here.