Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions monai/bundle/config_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,7 @@ def instantiate(self, **kwargs: Any) -> object:
mode = self.get_config().get("_mode_", CompInitMode.DEFAULT)
args = self.resolve_args()
args.update(kwargs)
try:
return instantiate(modname, mode, **args)
except Exception as e:
raise RuntimeError(f"Failed to instantiate {self}") from e
return instantiate(modname, mode, **args)


class ConfigExpression(ConfigItem):
Expand Down
2 changes: 1 addition & 1 deletion monai/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def instantiate(__path: str, __mode: str, **kwargs: Any) -> Any:
return pdb.runcall(component, **kwargs)
except Exception as e:
raise RuntimeError(
f"Failed to instantiate component '{__path}' with kwargs: {kwargs}"
f"Failed to instantiate component '{__path}' with keywords: {','.join(kwargs.keys())}"
f"\n set '_mode_={CompInitMode.DEBUG}' to enter the debugging mode."
) from e

Expand Down