Skip to content

Commit 15355af

Browse files
authored
Enable the args.deepspeed_config to use dict type (bigscience-workshop#290)
Signed-off-by: yuanwu <[email protected]>
1 parent 8760390 commit 15355af

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

megatron/training.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,12 @@ def print_datetime(string):
6969
'''
7070
def _create_ds_config_dict():
7171
args = get_args()
72-
with open(args.deepspeed_config, 'r', encoding='utf-8') as config_file:
73-
ds_config_dict = json.load(config_file)
74-
72+
if isinstance(args.deepspeed_config, dict) :
73+
ds_config_dict = args.deepspeed_config
74+
else:
75+
with open(args.deepspeed_config, 'r', encoding='utf-8') as config_file:
76+
ds_config_dict = json.load(config_file)
77+
7578
if args.universal_checkpoint:
7679
ds_config_dict["checkpoint"] = {"load_universal": True}
7780

0 commit comments

Comments
 (0)