Skip to content

Commit 90d5f19

Browse files
jinpengqigwang111
authored andcommitted
Update exception msg
1 parent f8fc9b1 commit 90d5f19

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/sagemaker/inference_recommender/inference_recommender_mixin.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,19 +398,17 @@ def _update_params_for_recommendation_id(
398398
# Update params beased on model recommendation
399399
if model_recommendation:
400400
if initial_instance_count is None:
401-
raise ValueError(
402-
"Please specify initial_instance_count with model recommendation id"
403-
)
401+
raise ValueError("Must specify model recommendation id and instance count.")
404402
self.env.update(model_recommendation["Environment"])
405403
instance_type = model_recommendation["InstanceType"]
406404
return (instance_type, initial_instance_count)
407405

408406
# Update params based on default inference recommendation
409407
if bool(instance_type) != bool(initial_instance_count):
410408
raise ValueError(
411-
"Please either do not specify instance_type and initial_instance_count"
412-
"since they are in recommendation, or specify both of them if you want"
413-
"to override the recommendation."
409+
"instance_type and initial_instance_count are mutually exclusive with"
410+
"recommendation id since they are in recommendation."
411+
"Please specify both of them if you want to override the recommendation."
414412
)
415413
input_config = right_size_job_res["InputConfig"]
416414
model_config = right_size_recommendation["ModelConfiguration"]

tests/unit/sagemaker/model/test_deploy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,9 @@ def test_deploy_ir_with_incompatible_parameters(sagemaker_session):
555555

556556
with pytest.raises(
557557
ValueError,
558-
match="Please either do not specify instance_type and initial_instance_count"
559-
"since they are in recommendation, or specify both of them if you want"
560-
"to override the recommendation.",
558+
match="instance_type and initial_instance_count are mutually exclusive with"
559+
"recommendation id since they are in recommendation."
560+
"Please specify both of them if you want to override the recommendation.",
561561
):
562562
model.deploy(
563563
instance_type=INSTANCE_TYPE,
@@ -566,9 +566,9 @@ def test_deploy_ir_with_incompatible_parameters(sagemaker_session):
566566

567567
with pytest.raises(
568568
ValueError,
569-
match="Please either do not specify instance_type and initial_instance_count"
570-
"since they are in recommendation, or specify both of them if you want"
571-
"to override the recommendation.",
569+
match="instance_type and initial_instance_count are mutually exclusive with"
570+
"recommendation id since they are in recommendation."
571+
"Please specify both of them if you want to override the recommendation.",
572572
):
573573
model.deploy(
574574
initial_instance_count=INSTANCE_COUNT,

0 commit comments

Comments
 (0)