Skip to content

Commit

Permalink
Prevent wrong config to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
jmercat committed May 4, 2024
1 parent b4003c7 commit 6277b33
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions open_lm/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ def _rescan_model_configs(model_config_paths=None):

for cf in config_files:
with open(cf, "r") as f:
model_cfg = json.load(f)
_MODEL_CONFIGS[cf.stem] = model_cfg
try:
model_cfg = json.load(f)
_MODEL_CONFIGS[cf.stem] = model_cfg
except json.JSONDecodeError:
print(f"Error loading model config {cf}")

_MODEL_CONFIGS = {k: v for k, v in sorted(_MODEL_CONFIGS.items(), key=lambda x: _natural_key(x[0]))}

Expand Down

0 comments on commit 6277b33

Please sign in to comment.