Skip to content

Commit e13478c

Browse files
author
Malav Shastri
committed
fix: ModelReference deployment for Alt Configs models
1 parent 791d3db commit e13478c

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/sagemaker/jumpstart/types.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,8 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
12771277
Args:
12781278
json_obj (Dict[str, Any]): Dictionary representation of spec.
12791279
"""
1280+
if self._is_hub_content:
1281+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
12801282
self.model_id: str = json_obj.get("model_id")
12811283
self.url: str = json_obj.get("url")
12821284
self.version: str = json_obj.get("version")
@@ -1722,6 +1724,8 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
17221724
json_obj (Dict[str, Any]): Dictionary representation of spec.
17231725
"""
17241726
super().from_json(json_obj)
1727+
if self._is_hub_content:
1728+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
17251729
self.inference_config_components: Optional[Dict[str, JumpStartConfigComponent]] = (
17261730
{
17271731
component_name: JumpStartConfigComponent(component_name, component)
@@ -1738,9 +1742,29 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
17381742
if json_obj.get("inference_config_rankings")
17391743
else None
17401744
)
1741-
inference_configs_dict: Optional[Dict[str, JumpStartMetadataConfig]] = json_obj[
1742-
"inference_configs"
1743-
]["Configs"]
1745+
inference_configs_dict: Optional[Dict[str, JumpStartMetadataConfig]] = (
1746+
{
1747+
alias: JumpStartMetadataConfig(
1748+
alias,
1749+
config,
1750+
json_obj,
1751+
(
1752+
{
1753+
component_name: self.inference_config_components.get(component_name)
1754+
for component_name in config.get("component_names")
1755+
}
1756+
if config and config.get("component_names")
1757+
else None
1758+
),
1759+
is_hub_content=self._is_hub_content,
1760+
)
1761+
for alias, config in json_obj["inference_configs"].items()
1762+
if alias != "scope"
1763+
}
1764+
if json_obj.get("inference_configs")
1765+
else None
1766+
)
1767+
17441768
self.inference_configs: Optional[JumpStartMetadataConfigs] = (
17451769
JumpStartMetadataConfigs(
17461770
inference_configs_dict,

0 commit comments

Comments
 (0)