Skip to content

fix: removing kwargs as this is breaking predictor_cls param for mode… #4816

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 8 commits into from
Aug 6, 2024
6 changes: 5 additions & 1 deletion src/sagemaker/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,7 @@ def deploy(
managed_instance_scaling: Optional[str] = None,
inference_component_name=None,
routing_config: Optional[Dict[str, Any]] = None,
model_reference_arn: Optional[str] = None,
**kwargs,
):
"""Deploy this ``Model`` to an ``Endpoint`` and optionally return a ``Predictor``.
Expand Down Expand Up @@ -1483,6 +1484,8 @@ def deploy(
{
"RoutingStrategy": sagemaker.enums.RoutingStrategy.RANDOM
}
model_reference_arn (Optional [str]): Hub Content Arn of a Model Reference type
content (default: None).
Raises:
ValueError: If arguments combination check failed in these circumstances:
- If no role is specified or
Expand Down Expand Up @@ -1697,7 +1700,8 @@ def deploy(
accelerator_type=accelerator_type,
tags=tags,
serverless_inference_config=serverless_inference_config,
**kwargs,
Copy link
Member

Choose a reason for hiding this comment

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

optional: maybe log any kwargs that are being ignored?

accept_eula=accept_eula,
model_reference_arn=model_reference_arn,
)
serverless_inference_config_dict = (
serverless_inference_config._to_request_dict() if is_serverless else None
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/sagemaker/jumpstart/model/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ def test_jumpstart_model_kwargs_match_parent_class(self):
and reach out to JumpStart team."""

init_args_to_skip: Set[str] = set(["model_reference_arn"])
deploy_args_to_skip: Set[str] = set(["kwargs"])
deploy_args_to_skip: Set[str] = set(["kwargs", "model_reference_arn"])
Copy link
Member

Choose a reason for hiding this comment

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

why don't we accept this argument for JumpStartModel.deploy?

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1


parent_class_init = Model.__init__
parent_class_init_args = set(signature(parent_class_init).parameters.keys())
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/sagemaker/model/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ def test_deploy_accelerator_type(
accelerator_type=ACCELERATOR_TYPE,
tags=None,
serverless_inference_config=None,
accept_eula=None,
model_reference_arn=None,
)
production_variant.assert_called_with(
MODEL_NAME,
Expand Down Expand Up @@ -299,6 +301,8 @@ def test_deploy_tags(create_sagemaker_model, production_variant, name_from_base,
accelerator_type=None,
tags=tags,
serverless_inference_config=None,
accept_eula=None,
model_reference_arn=None,
)
sagemaker_session.endpoint_from_production_variants.assert_called_with(
name=ENDPOINT_NAME,
Expand Down Expand Up @@ -502,6 +506,8 @@ def test_deploy_serverless_inference(production_variant, create_sagemaker_model,
accelerator_type=None,
tags=None,
serverless_inference_config=serverless_inference_config,
accept_eula=None,
model_reference_arn=None,
)
production_variant.assert_called_with(
MODEL_NAME,
Expand Down