Skip to content

Directly use customer-provided endpoint name for ModelBuilder deployment. #5246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/sagemaker/serve/builder/model_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
validate_image_uri_and_hardware,
)
from sagemaker.serverless import ServerlessInferenceConfig
from sagemaker.utils import Tags, unique_name_from_base
from sagemaker.utils import Tags
from sagemaker.workflow.entities import PipelineVariable
from sagemaker.huggingface.llm_utils import (
get_huggingface_model_metadata,
Expand Down Expand Up @@ -1983,8 +1983,6 @@ def deploy(
"""
if not hasattr(self, "built_model") and not hasattr(self, "_deployables"):
raise ValueError("Model needs to be built before deploying")
if not update_endpoint:
endpoint_name = unique_name_from_base(endpoint_name)

if not hasattr(self, "_deployables"):
if not inference_config: # Real-time Deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def invoke(self, input_object: object, model: object):

def test_real_time_deployment(xgboost_model_builder):
real_time_predictor = xgboost_model_builder.deploy(
endpoint_name="test", initial_instance_count=1
endpoint_name=f"test-{uuid.uuid1().hex}", initial_instance_count=1
)

assert real_time_predictor is not None
Expand All @@ -198,7 +198,7 @@ def test_real_time_deployment(xgboost_model_builder):

def test_serverless_deployment(xgboost_model_builder):
serverless_predictor = xgboost_model_builder.deploy(
endpoint_name="test1", inference_config=ServerlessInferenceConfig()
endpoint_name=f"test1-{uuid.uuid1().hex}", inference_config=ServerlessInferenceConfig()
)

assert serverless_predictor is not None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import pytest
import tests.integ
import uuid

from botocore.exceptions import ClientError
from sagemaker.predictor import Predictor
Expand Down Expand Up @@ -88,7 +89,7 @@ def test_model_builder_ic_sagemaker_endpoint(
with timeout(minutes=SERVE_SAGEMAKER_ENDPOINT_TIMEOUT):
try:
logger.info("Deploying and predicting in SAGEMAKER_ENDPOINT mode...")
endpoint_name = "llama-ic-endpoint-name"
endpoint_name = f"llama-ic-endpoint-name-{uuid.uuid1().hex}"
predictors = chain.deploy(
instance_type=INSTANCE_TYPE,
initial_instance_count=1,
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/sagemaker/serve/builder/test_model_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4241,9 +4241,7 @@ def test_neuron_configurations_rule_set(self):
"Batch",
],
)
@patch("sagemaker.serve.builder.model_builder.unique_name_from_base")
def test_deploy(mock_unique_name_from_base, test_case):
mock_unique_name_from_base.return_value = "test"
def test_deploy(test_case):
model: Model = MagicMock()
model_builder = ModelBuilder(
model="meta-llama/Meta-Llama-3-8B-Instruct",
Expand Down