|
39 | 39 | from sagemaker.compute_resource_requirements.resource_requirements import ResourceRequirements |
40 | 40 | from sagemaker.enums import EndpointType |
41 | 41 | from sagemaker.jumpstart.hub.parser_utils import ( |
42 | | - pascal_to_snake, |
| 42 | + camel_to_snake, |
43 | 43 | walk_and_apply_json, |
44 | 44 | ) |
45 | 45 |
|
@@ -239,7 +239,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None: |
239 | 239 | return |
240 | 240 |
|
241 | 241 | if self._is_hub_content: |
242 | | - json_obj = walk_and_apply_json(json_obj, pascal_to_snake) |
| 242 | + json_obj = walk_and_apply_json(json_obj, camel_to_snake) |
243 | 243 |
|
244 | 244 | self.framework = json_obj.get("framework") |
245 | 245 | self.framework_version = json_obj.get("framework_version") |
@@ -293,7 +293,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None: |
293 | 293 | """ |
294 | 294 |
|
295 | 295 | if self._is_hub_content: |
296 | | - json_obj = walk_and_apply_json(json_obj, pascal_to_snake) |
| 296 | + json_obj = walk_and_apply_json(json_obj, camel_to_snake) |
297 | 297 | self.name = json_obj["name"] |
298 | 298 | self.type = json_obj["type"] |
299 | 299 | self.default = json_obj["default"] |
@@ -361,7 +361,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None: |
361 | 361 | Args: |
362 | 362 | json_obj (Dict[str, Any]): Dictionary representation of environment variable. |
363 | 363 | """ |
364 | | - json_obj = walk_and_apply_json(json_obj, pascal_to_snake) |
| 364 | + json_obj = walk_and_apply_json(json_obj, camel_to_snake) |
365 | 365 | self.name = json_obj["name"] |
366 | 366 | self.type = json_obj["type"] |
367 | 367 | self.default = json_obj["default"] |
@@ -411,7 +411,7 @@ def from_json(self, json_obj: Optional[Dict[str, Any]]) -> None: |
411 | 411 | return |
412 | 412 |
|
413 | 413 | if self._is_hub_content: |
414 | | - json_obj = walk_and_apply_json(json_obj, pascal_to_snake) |
| 414 | + json_obj = walk_and_apply_json(json_obj, camel_to_snake) |
415 | 415 | self.default_content_type = json_obj["default_content_type"] |
416 | 416 | self.supported_content_types = json_obj["supported_content_types"] |
417 | 417 | self.default_accept_type = json_obj["default_accept_type"] |
@@ -465,7 +465,7 @@ def from_json(self, json_obj: Optional[Dict[str, Any]]) -> None: |
465 | 465 | return |
466 | 466 |
|
467 | 467 | if self._is_hub_content: |
468 | | - json_obj = walk_and_apply_json(json_obj, pascal_to_snake) |
| 468 | + json_obj = walk_and_apply_json(json_obj, camel_to_snake) |
469 | 469 | self.raw_payload = json_obj |
470 | 470 | self.content_type = json_obj["content_type"] |
471 | 471 | self.body = json_obj.get("body") |
@@ -538,7 +538,7 @@ def from_describe_hub_content_response(self, response: Optional[Dict[str, Any]]) |
538 | 538 | if response is None: |
539 | 539 | return |
540 | 540 |
|
541 | | - response = walk_and_apply_json(response, pascal_to_snake) |
| 541 | + response = walk_and_apply_json(response, camel_to_snake) |
542 | 542 | self.aliases: Optional[dict] = response.get("aliases") |
543 | 543 | self.regional_aliases = None |
544 | 544 | self.variants: Optional[dict] = response.get("variants") |
@@ -1174,7 +1174,7 @@ def __init__(self, spec: Optional[Dict[str, Any]], is_hub_content=False): |
1174 | 1174 | spec (Dict[str, Any]): Dictionary representation of training config ranking. |
1175 | 1175 | """ |
1176 | 1176 | if is_hub_content: |
1177 | | - spec = walk_and_apply_json(spec, pascal_to_snake) |
| 1177 | + spec = walk_and_apply_json(spec, camel_to_snake) |
1178 | 1178 | self.from_json(spec) |
1179 | 1179 |
|
1180 | 1180 | def from_json(self, json_obj: Dict[str, Any]) -> None: |
@@ -1280,7 +1280,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None: |
1280 | 1280 | json_obj (Dict[str, Any]): Dictionary representation of spec. |
1281 | 1281 | """ |
1282 | 1282 | if self._is_hub_content: |
1283 | | - json_obj = walk_and_apply_json(json_obj, pascal_to_snake) |
| 1283 | + json_obj = walk_and_apply_json(json_obj, camel_to_snake) |
1284 | 1284 | self.model_id: str = json_obj.get("model_id") |
1285 | 1285 | self.url: str = json_obj.get("url") |
1286 | 1286 | self.version: str = json_obj.get("version") |
@@ -1509,7 +1509,7 @@ def __init__( |
1509 | 1509 | ValueError: If the component field is invalid. |
1510 | 1510 | """ |
1511 | 1511 | if is_hub_content: |
1512 | | - component = walk_and_apply_json(component, pascal_to_snake) |
| 1512 | + component = walk_and_apply_json(component, camel_to_snake) |
1513 | 1513 | self.component_name = component_name |
1514 | 1514 | super().__init__(component, is_hub_content) |
1515 | 1515 | self.from_json(component) |
@@ -1562,8 +1562,8 @@ def __init__( |
1562 | 1562 | The list of components that are used to construct the resolved config. |
1563 | 1563 | """ |
1564 | 1564 | if is_hub_content: |
1565 | | - config = walk_and_apply_json(config, pascal_to_snake) |
1566 | | - base_fields = walk_and_apply_json(base_fields, pascal_to_snake) |
| 1565 | + config = walk_and_apply_json(config, camel_to_snake) |
| 1566 | + base_fields = walk_and_apply_json(base_fields, camel_to_snake) |
1567 | 1567 | self.base_fields = base_fields |
1568 | 1568 | self.config_components: Dict[str, JumpStartConfigComponent] = config_components |
1569 | 1569 | self.benchmark_metrics: Dict[str, List[JumpStartBenchmarkStat]] = ( |
@@ -1729,7 +1729,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None: |
1729 | 1729 | """ |
1730 | 1730 | super().from_json(json_obj) |
1731 | 1731 | if self._is_hub_content: |
1732 | | - json_obj = walk_and_apply_json(json_obj, pascal_to_snake) |
| 1732 | + json_obj = walk_and_apply_json(json_obj, camel_to_snake) |
1733 | 1733 | self.inference_config_components: Optional[Dict[str, JumpStartConfigComponent]] = ( |
1734 | 1734 | { |
1735 | 1735 | component_name: JumpStartConfigComponent(component_name, component) |
|
0 commit comments