Skip to content

Commit 62793d2

Browse files
Merge branch 'master' into fix-clarify-mm
2 parents f690b2d + 40432b3 commit 62793d2

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies = [
4040
"importlib-metadata>=1.4.0,<7.0",
4141
"jsonschema",
4242
"numpy==1.26.4",
43-
"omegaconf>=2.2,<=2.3",
43+
"omegaconf>=2.2,<3",
4444
"packaging>=23.0,<25",
4545
"pandas",
4646
"pathos",

src/sagemaker/feature_store/feature_processor/_input_offset_parser.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,16 @@ def get_offset_datetime(self, offset: Optional[str]) -> datetime:
7272

7373
return self.now + offset_td
7474

75-
def get_offset_date_year_month_day_hour(self, offset: Optional[str]) -> Tuple[str]:
75+
def get_offset_date_year_month_day_hour(
76+
self, offset: Optional[str]
77+
) -> Tuple[str, str, str, str]:
7678
"""Get the year, month, day and hour based on offset diff.
7779
7880
Args:
7981
offset (Optional[str]): Offset that is used for target date calcluation.
8082
8183
Returns:
82-
Tuple[str]: A tuple that consists of extracted year, month, day, hour from offset date.
84+
Tuple[str, str, str, str]: A tuple that consists of extracted year, month, day, hour from offset date.
8385
"""
8486
if offset is None:
8587
return (None, None, None, None)

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

-9
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ 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).
129127
3. If `data` is a JSON-encoded string, it attempts to deserialize it using `json.loads()`.
130128
4. If `data` is a string but cannot be decoded as JSON, it returns the original string.
131129
@@ -134,13 +132,6 @@ def safe_deserialize(data: Any) -> Any:
134132
"""
135133
if not isinstance(data, str):
136134
return data
137-
138-
lower_data = data.lower()
139-
if lower_data in ["true"]:
140-
return True
141-
if lower_data in ["false"]:
142-
return False
143-
144135
try:
145136
return json.loads(data)
146137
except json.JSONDecodeError:

src/sagemaker/modules/train/model_trainer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ def _prepare_train_script(
865865
working_dir = f"cd {SM_CODE_CONTAINER_PATH} \n"
866866
if source_code.source_dir.endswith(".tar.gz"):
867867
tarfile_name = os.path.basename(source_code.source_dir)
868-
working_dir += f"tar --strip-components=1 -xzf {tarfile_name} \n"
868+
working_dir += f"tar -xzf {tarfile_name} \n"
869869

870870
if base_command:
871871
execute_driver = EXECUTE_BASE_COMMANDS.format(base_command=base_command)
-139 Bytes
Binary file not shown.

tests/unit/sagemaker/modules/train/container_drivers/test_utils.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,14 @@ def test_safe_deserialize_not_a_string():
5959
def test_safe_deserialize_boolean_strings():
6060
assert safe_deserialize("true") is True
6161
assert safe_deserialize("false") is False
62-
assert safe_deserialize("True") is True
63-
assert safe_deserialize("False") is False
62+
63+
# The below are not valid JSON booleans
64+
assert safe_deserialize("True") == "True"
65+
assert safe_deserialize("False") == "False"
66+
assert safe_deserialize("TRUE") == "TRUE"
67+
assert safe_deserialize("FALSE") == "FALSE"
68+
assert safe_deserialize("tRuE") == "tRuE"
69+
assert safe_deserialize("fAlSe") == "fAlSe"
6470

6571

6672
def test_safe_deserialize_valid_json_string():

0 commit comments

Comments
 (0)