Skip to content

Commit 5ab02e4

Browse files
author
Malav Shastri
committed
address nits
1 parent 7571a55 commit 5ab02e4

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/sagemaker/jumpstart/accessors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def get_model_specs(
301301

302302
except Exception as ex:
303303
logging.info(
304-
"Recieved expection while calling APIs for ContentType Model: " + str(ex)
304+
"Recieved exeption while calling APIs for ContentType Model, retrying with ContentType ModelReference: " + str(ex)
305305
)
306306
hub_model_arn = construct_hub_model_arn_from_inputs(
307307
hub_arn=hub_arn, model_name=model_id, version=version

src/sagemaker/jumpstart/hub/hub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def describe_model(
286286
)
287287

288288
except Exception as ex:
289-
logging.info("Recieved expection while calling APIs for ContentType Model: " + str(ex))
289+
logging.info("Recieved exeption while calling APIs for ContentType Model, retrying with ContentType ModelReference: " + str(ex))
290290
model_version = get_hub_model_version(
291291
hub_model_name=model_name,
292292
hub_model_type=HubContentType.MODEL_REFERENCE.value,

src/sagemaker/jumpstart/hub/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ def get_hub_model_version(
193193
hub_model_version: Optional[str] = None,
194194
sagemaker_session: Session = constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION,
195195
) -> str:
196-
"""Returns available Jumpstart hub model version"""
196+
"""Returns available Jumpstart hub model version
197+
198+
Raises:
199+
ResourceNotFound: If the specified model is not found in the hub.
200+
"""
197201

198202
try:
199203
hub_content_summaries = sagemaker_session.list_hub_content_versions(

src/sagemaker/jumpstart/types.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from copy import deepcopy
1818
from enum import Enum
1919
from typing import Any, Dict, List, Optional, Set, Union
20+
from sagemaker.jumpstart.constants import HUB_ARN_REGEX, HUB_CONTENT_ARN_REGEX
2021
from sagemaker.model_card.model_card import ModelCard, ModelPackageModelCard
2122
from sagemaker.utils import get_instance_type_family, format_tags, Tags, deep_override_dict
2223
from sagemaker.model_metrics import ModelMetrics
@@ -1412,6 +1413,7 @@ def __init__(self, spec: Dict[str, Any], is_hub_content: Optional[bool] = False)
14121413
14131414
Args:
14141415
spec (Dict[str, Any]): Dictionary representation of spec.
1416+
is_hub_content (Optional[bool]): Whether the model is from a private hub.
14151417
"""
14161418
super().__init__(spec, is_hub_content)
14171419
self.from_json(spec)
@@ -1666,10 +1668,6 @@ def __init__(
16661668
def extract_region_from_arn(arn: str) -> Optional[str]:
16671669
"""Extracts hub_name, content_name, and content_version from a HubContentArn"""
16681670

1669-
HUB_CONTENT_ARN_REGEX = (
1670-
r"arn:(.*?):sagemaker:(.*?):(.*?):hub-content/(.*?)/(.*?)/(.*?)/(.*?)$"
1671-
)
1672-
HUB_ARN_REGEX = r"arn:(.*?):sagemaker:(.*?):(.*?):hub/(.*?)$"
16731671

16741672
match = re.match(HUB_CONTENT_ARN_REGEX, arn)
16751673
hub_region = None

0 commit comments

Comments
 (0)