Update copy_model_files()

This commit is contained in:
Eren Gölge
2021-09-30 14:47:56 +00:00
parent 4163b4f2e4
commit 9a0d8fa027
+2 -1
View File
@@ -38,7 +38,8 @@ def copy_model_files(config: Coqpit, out_path, new_fields):
"""
copy_config_path = os.path.join(out_path, "config.json")
# add extra information fields
config.update(new_fields, allow_new=True)
if new_fields:
config.update(new_fields, allow_new=True)
# TODO: Revert to config.save_json() once Coqpit supports arbitrary paths.
with fsspec.open(copy_config_path, "w", encoding="utf8") as f:
json.dump(config.to_dict(), f, indent=4)