-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Is your feature request related to a problem? Please describe.
When there is an error in the monai bundle config during instantiation, and the config is large, the RuntimeError ends up being extremely long.
This is counterproductive for debugging and pollutes the terminal with uninformative error messages.
The root cause of this looks to be the RuntimeError messages generated here:
MONAI/monai/bundle/config_item.py
Line 295 in ff43028
raise RuntimeError(f"Failed to instantiate {self}") from e Line 274 in ff43028
raise RuntimeError(
To Reproduce
Run any relatively large configuration with a wrongly configured argument, and this will occur.
Attached is an example config and the error log below.
The command run for the bundle to run is
python -m monai.bundle run system --config_file config.yaml
error_log.txt
config.json [YAML renamed to JSON as github doesn't allow uploading YAML]
Describe the solution you'd like
A clear and concise error message would be more informative.
I have the following suggestions:
- Remove the
RuntimeErrorraised inConfigComponentas the instantiate call will already raise it. Remove this basically:MONAI/monai/bundle/config_item.py
Line 295 in ff43028
raise RuntimeError(f"Failed to instantiate {self}") from e - It would be ideal if the RuntimeError raised in shows only the
Line 274 in ff43028
raise RuntimeError( __pathand not the fullkwargsby default. Maybe this could be moved into debug mode instead?