chore: Handle ImportError when importing models · EvolvingLMMs-Lab/lmms-eval@af38885 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit af38885

chore: Handle ImportError when importing models

Handle the ImportError exception when importing models in the lmms_eval package. This change adds a try-except block to catch the ImportError and print an error message indicating the failed import. This will help with troubleshooting and identifying any issues with the model imports.

File tree

1 file changed

lines changed

1 file changed

lines changed

Lines changed: 2 additions & 1 deletion

Original file line number Diff line number Diff line change
@@ -34,5 +34,6 @@
34 34 for model_name, model_class in AVAILABLE_MODELS.items():
35 35 try:
36 36 exec(f"from .{model_name} import {model_class}")
37 -except ImportError:
37 +except ImportError as e:
38 +print(f"Failed to import {model_class} from {model_name}: {e}")
38 39 pass