Update utils.py
This commit is contained in:
7
utils.py
7
utils.py
@@ -206,15 +206,14 @@ def get_hparams(init=True):
|
||||
config_path = args.config
|
||||
config_save_path = os.path.join(model_dir, "config.json")
|
||||
if init:
|
||||
with open(config_path, "r") as f:
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
data = f.read()
|
||||
with open(config_save_path, "w") as f:
|
||||
with open(config_save_path, "w", encoding="utf-8") as f:
|
||||
f.write(data)
|
||||
else:
|
||||
with open(config_save_path, "r") as f:
|
||||
with open(config_save_path, "r", vencoding="utf-8") as f:
|
||||
data = f.read()
|
||||
config = json.loads(data)
|
||||
|
||||
hparams = HParams(**config)
|
||||
hparams.model_dir = model_dir
|
||||
return hparams
|
||||
|
||||
Reference in New Issue
Block a user