Skip to content

Commit

Permalink
Handle double specified load_model
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippThoelke committed May 21, 2022
1 parent 39a2a3d commit 0191427
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions torchmdnet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ def __call__(self, parser, namespace, values, option_string=None):
for key in config.keys():
if key not in namespace:
raise ValueError(f"Unknown argument in config file: {key}")
if (
"load_model" in config
and namespace.load_model is not None
and config["load_model"] != namespace.load_model
):
rank_zero_warn(
f"The load model argument was specified as a command line argument "
f"({namespace.load_model}) and in the config file ({config['load_model']}). "
f"Ignoring 'load_model' from the config file and loading {namespace.load_model}."
)
namespace.__dict__.update(config)
else:
raise ValueError("Configuration file must end with yaml or yml")
Expand Down

0 comments on commit 0191427

Please sign in to comment.