@@ -1277,6 +1277,8 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
1277
1277
Args:
1278
1278
json_obj (Dict[str, Any]): Dictionary representation of spec.
1279
1279
"""
1280
+ if self ._is_hub_content :
1281
+ json_obj = walk_and_apply_json (json_obj , camel_to_snake )
1280
1282
self .model_id : str = json_obj .get ("model_id" )
1281
1283
self .url : str = json_obj .get ("url" )
1282
1284
self .version : str = json_obj .get ("version" )
@@ -1722,6 +1724,8 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
1722
1724
json_obj (Dict[str, Any]): Dictionary representation of spec.
1723
1725
"""
1724
1726
super ().from_json (json_obj )
1727
+ if self ._is_hub_content :
1728
+ json_obj = walk_and_apply_json (json_obj , camel_to_snake )
1725
1729
self .inference_config_components : Optional [Dict [str , JumpStartConfigComponent ]] = (
1726
1730
{
1727
1731
component_name : JumpStartConfigComponent (component_name , component )
@@ -1738,9 +1742,29 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
1738
1742
if json_obj .get ("inference_config_rankings" )
1739
1743
else None
1740
1744
)
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
+
1744
1768
self .inference_configs : Optional [JumpStartMetadataConfigs ] = (
1745
1769
JumpStartMetadataConfigs (
1746
1770
inference_configs_dict ,
0 commit comments