You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
With the change of how Enums are handled in python 3.11 onwards there is an inconsistency with how class members are handled. In the utils.py file for hub, when generating the HubContentArn, the SDK will create this with HubContentType.MODEL_REFERENCE as is in the Arn. However if using 3.10 then this will output the expected ModelReference as it is here.
A simple resolution would be to change HubContentType.MODEL_REFERENCE to HubContentType.MODEL_REFERENCE.value in the utils.py function.
To reproduce
The easiest way to test is to create 2 kernels that use different python versions (one must be 3.10 and the other 3.11) and install the latest version of boto3 & sagemaker.
You can then run the attached Notebook:
Describe the bug
With the change of how Enums are handled in python 3.11 onwards there is an inconsistency with how class members are handled. In the utils.py file for
hub
, when generating theHubContentArn
, the SDK will create this withHubContentType.MODEL_REFERENCE
as is in the Arn. However if using 3.10 then this will output the expectedModelReference
as it is here.A simple resolution would be to change
HubContentType.MODEL_REFERENCE
toHubContentType.MODEL_REFERENCE.value
in the utils.py function.To reproduce
The easiest way to test is to create 2 kernels that use different python versions (one must be 3.10 and the other 3.11) and install the latest version of boto3 & sagemaker.
You can then run the attached Notebook:
Expected behavior
Should create an Endpoint that uses a Private Curated Hub
Screenshots or logs
Here is the error message that you will see:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in :1 │
│ │
│ ❱ 1 model.deploy(endpoint_name="huggingface-llm-mistral-nemo-i-2407") │
│ 2 │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker/jumpstart/model.py:844 in deploy │
│ │
│ 841 │ │ ) │
│ 842 │ │ │
│ 843 │ │ try: │
│ ❱ 844 │ │ │ predictor = super(JumpStartModel, self).deploy(**deploy_kwargs.to_kwargs_dic │
│ 845 │ │ except ClientError as e: │
│ 846 │ │ │ subscription_link = verify_model_region_and_return_specs( │
│ 847 │ │ │ │ region=self.region, │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker/model.py:1725 in deploy │
│ │
│ 1722 │ │ │ return None │
│ 1723 │ │ │
│ 1724 │ │ else: # existing single model endpoint path │
│ ❱ 1725 │ │ │ self._create_sagemaker_model( │
│ 1726 │ │ │ │ instance_type=instance_type, │
│ 1727 │ │ │ │ accelerator_type=accelerator_type, │
│ 1728 │ │ │ │ tags=tags, │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker/jumpstart/model.py:634 in │
│ _create_sagemaker_model │
│ │
│ 631 │ │ │ if self.name is None and model_package.name is not None: │
│ 632 │ │ │ │ self.name = model_package.name │
│ 633 │ │ else: │
│ ❱ 634 │ │ │ super(JumpStartModel, self)._create_sagemaker_model( │
│ 635 │ │ │ │ instance_type=instance_type, │
│ 636 │ │ │ │ accelerator_type=accelerator_type, │
│ 637 │ │ │ │ tags=tags, │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker/model.py:985 in _create_sagemaker_model │
│ │
│ 982 │ │ │ │ enable_network_isolation=self._enable_network_isolation, │
│ 983 │ │ │ │ tags=format_tags(tags), │
│ 984 │ │ │ ) │
│ ❱ 985 │ │ │ self.sagemaker_session.create_model(**create_model_args) │
│ 986 │ │
│ 987 │ def _get_model_uri(self): │
│ 988 │ │ model_uri = None │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker/session.py:4109 in create_model │
│ │
│ 4106 │ │ │ │ else: │
│ 4107 │ │ │ │ │ raise │
│ 4108 │ │ │
│ ❱ 4109 │ │ self.intercept_create_request(create_model_request, submit, self.create_model. │
│ 4110 │ │ return name │
│ 4111 │ │
│ 4112 │ def create_model_from_job( │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker/session.py:6678 in _intercept_create_request │
│ │
│ 6675 │ │ │ create (functor): a functor calls the sagemaker client create method │
│ 6676 │ │ │ func_name (str): the name of the function needed intercepting │
│ 6677 │ │ """ │
│ ❱ 6678 │ │ return create(request) │
│ 6679 │ │
│ 6680 │ def _create_inference_recommendations_job_request( │
│ 6681 │ │ self, │
│ │
│ /opt/conda/lib/python3.11/site-packages/sagemaker/session.py:4097 in submit │
│ │
│ 4094 │ │ │ logger.info("Creating model with name: %s", name) │
│ 4095 │ │ │ logger.debug("CreateModel request: %s", json.dumps(request, indent=4)) │
│ 4096 │ │ │ try: │
│ ❱ 4097 │ │ │ │ self.sagemaker_client.create_model(**request) │
│ 4098 │ │ │ except ClientError as e: │
│ 4099 │ │ │ │ error_code = e.response["Error"]["Code"] │
│ 4100 │ │ │ │ message = e.response["Error"]["Message"] │
│ │
│ /opt/conda/lib/python3.11/site-packages/botocore/client.py:569 in _api_call │
│ │
│ 566 │ │ │ │ │ f"{py_operation_name}() only accepts keyword arguments." │
│ 567 │ │ │ │ ) │
│ 568 │ │ │ # The "self" in this scope is referring to the BaseClient. │
│ ❱ 569 │ │ │ return self._make_api_call(operation_name, kwargs) │
│ 570 │ │ │
│ 571 │ │ _api_call.name = str(py_operation_name) │
│ 572 │
│ │
│ /opt/conda/lib/python3.11/site-packages/botocore/client.py:1023 in _make_api_call │
│ │
│ 1020 │ │ │ │ "Code" │
│ 1021 │ │ │ ) │
│ 1022 │ │ │ error_class = self.exceptions.from_code(error_code) │
│ ❱ 1023 │ │ │ raise error_class(parsed_response, operation_name) │
│ 1024 │ │ else: │
│ 1025 │ │ │ return parsed_response │
│ 1026 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ClientError: An error occurred (ValidationException) when calling the CreateModel operation: Invalid HubContentArn
to deploy hub model.
System information
A description of your system. Please provide:
The text was updated successfully, but these errors were encountered: