Skip to content

Commit c0c4002

Browse files
committed
fix: honor json serialization of HPs
aws/sagemaker-python-sdk-staging@246d560
1 parent f04e341 commit c0c4002

File tree

1 file changed

+2
-10
lines changed
  • sagemaker-core/src/sagemaker/core/modules/train/container_drivers/common

1 file changed

+2
-10
lines changed

sagemaker-core/src/sagemaker/core/modules/train/container_drivers/common/utils.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,23 +124,15 @@ def safe_deserialize(data: Any) -> Any:
124124
125125
This function handles the following cases:
126126
1. If `data` is not a string, it returns the input as-is.
127-
2. If `data` is a string and matches common boolean values ("true" or "false"),
128-
it returns the corresponding boolean value (True or False).
129-
3. If `data` is a JSON-encoded string, it attempts to deserialize it using `json.loads()`.
130-
4. If `data` is a string but cannot be decoded as JSON, it returns the original string.
127+
2. If `data` is a JSON-encoded string, it attempts to deserialize it using `json.loads()`.
128+
3. If `data` is a string but cannot be decoded as JSON, it returns the original string.
131129
132130
Returns:
133131
Any: The deserialized data, or the original input if it cannot be JSON-decoded.
134132
"""
135133
if not isinstance(data, str):
136134
return data
137135

138-
lower_data = data.lower()
139-
if lower_data in ["true"]:
140-
return True
141-
if lower_data in ["false"]:
142-
return False
143-
144136
try:
145137
return json.loads(data)
146138
except json.JSONDecodeError:

0 commit comments

Comments
 (0)