Skip to content

Commit 6277b33

Browse files
committed
Prevent wrong config to fail
1 parent b4003c7 commit 6277b33

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
@@ -67,8 +67,11 @@ def _rescan_model_configs(model_config_paths=None):
6767

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

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

0 commit comments

Comments
 (0)