Skip to content

Commit 748531d

Browse files
Yongyan Raoclaytonparnell
Yongyan Rao
authored andcommitted
Remove yaml for config file
1 parent 09b7deb commit 748531d

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

src/sagemaker/fw_utils.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import tempfile
2323
from collections import namedtuple
2424
from typing import Optional, Union, Dict
25-
import yaml
2625

2726
import sagemaker.image_uris
2827
from sagemaker.session_settings import SessionSettings
@@ -222,7 +221,7 @@ def parse_mp_parameters(params):
222221
223222
Raises:
224223
ValueError: if params is not a string or a dict, or
225-
the config file cannot be parsed as json or yaml.
224+
the config file cannot be parsed as json.
226225
"""
227226
parsed = None
228227
if isinstance(params, dict):
@@ -232,19 +231,15 @@ def parse_mp_parameters(params):
232231
with open(params, "r") as fp:
233232
parsed = json.load(fp)
234233
except json.decoder.JSONDecodeError:
235-
try:
236-
with open(params, "r") as fp:
237-
parsed = yaml.load(fp)
238-
except yaml.YAMLError:
239-
pass
234+
pass
240235
else:
241236
raise ValueError(
242237
f"Expected a string path to an existing modelparallel config, or a dictionary. "
243238
f"Received: {params}."
244239
)
245240

246241
if parsed is None:
247-
raise ValueError(f"Cannot parse {params} as a json or yaml file.")
242+
raise ValueError(f"Cannot parse {params} as a json file.")
248243

249244
return parsed
250245

tests/unit/test_fw_utils.py

-19
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import tarfile
1919
from contextlib import contextmanager
2020
from itertools import product
21-
import yaml
2221

2322
import pytest
2423

@@ -226,24 +225,6 @@ def test_parse_mp_parameters_input_str_json():
226225
os.remove(json_file_path)
227226

228227

229-
def test_parse_mp_parameters_input_str_yaml():
230-
mp_parameters = {
231-
"partitions": 1,
232-
"tensor_parallel_degree": 2,
233-
"microbatches": 1,
234-
"optimize": "speed",
235-
"pipeline": "interleaved",
236-
"ddp": 1,
237-
"auto_partition": False,
238-
"default_partition": 0,
239-
}
240-
yaml_file_path = "./params.yaml"
241-
with open(yaml_file_path, "x") as fp:
242-
yaml.dump(mp_parameters, fp)
243-
assert mp_parameters == fw_utils.parse_mp_parameters(yaml_file_path)
244-
os.remove(yaml_file_path)
245-
246-
247228
def test_parse_mp_parameters_input_not_exit():
248229
with pytest.raises(ValueError):
249230
fw_utils.parse_mp_parameters(" !@#$%^&*()path probably in not there.!@#$%^&*()")

0 commit comments

Comments
 (0)