Skip to content

Commit 10ba930

Browse files
committed
Prevent wrong config to fail
1 parent 6ead2b5 commit 10ba930

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

open_lm/model.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ def _rescan_model_configs(model_config_paths=None):
6868

6969
for cf in config_files:
7070
with open(cf, "r") as f:
71-
model_cfg = json.load(f)
72-
_MODEL_CONFIGS[cf.stem] = model_cfg
71+
try:
72+
model_cfg = json.load(f)
73+
_MODEL_CONFIGS[cf.stem] = model_cfg
74+
except json.JSONDecodeError:
75+
print(f"Error loading model config {cf}")
7376

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

0 commit comments

Comments
 (0)