Skip to content

Serverless inference tutorial using sagemaker sdk - #2639

Open
dwarez wants to merge 4 commits into
mainfrom
serverless-inference-tutorial
Open

Serverless inference tutorial using sagemaker sdk#2639
dwarez wants to merge 4 commits into
mainfrom
serverless-inference-tutorial

Conversation

@dwarez

@dwarez dwarez commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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.5 with the TEI CPU container via ModelBuilder and ServerlessInferenceConfig (memory, max concurrency, optional provisioned concurrency) instead of an instance_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.

Signed-off-by: DWarez <dario.salvati@huggingface.co>
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b857108. Configure here.

@dwarez
dwarez requested review from alvarobartt and ehcalabres July 10, 2026 09:42
change: more precise phrasing regarding costs

Signed-off-by: DWarez <dario.salvati@huggingface.co>
@dwarez
dwarez requested a review from juanjucm July 20, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants