Closed
Description
Describe the bug
{
"name": "ModuleNotFoundError",
"message": "Cannot locate class or function path: 'RetinaNetDetector'.",
"stack": "---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 8
5 bundle_config = ConfigParser()
6 bundle_config.read_config(config)
----> 8 a = bundle_config.get_parsed_content(\"detector\", instantiate=True)
File /workspace/Code/MONAI/monai/bundle/config_parser.py:290, in ConfigParser.get_parsed_content(self, id, **kwargs)
288 elif not kwargs.get(\"lazy\", True):
289 self.parse(reset=not kwargs.get(\"lazy\", True))
--> 290 return self.ref_resolver.get_resolved_content(id=id, **kwargs)
File /workspace/Code/MONAI/monai/bundle/reference_resolver.py:193, in ReferenceResolver.get_resolved_content(self, id, **kwargs)
181 def get_resolved_content(self, id: str, **kwargs: Any) -> ConfigExpression | str | Any | None:
182 \"\"\"
183 Get the resolved ``ConfigItem`` by id.
184
(...)
191
192 \"\"\"
--> 193 return self._resolve_one_item(id=id, **kwargs)
File /workspace/Code/MONAI/monai/bundle/reference_resolver.py:171, in ReferenceResolver._resolve_one_item(self, id, waiting_list, **kwargs)
169 # save the resolved result into `resolved_content` to recursively resolve others
170 if isinstance(item, ConfigComponent):
--> 171 self.resolved_content[id] = item.instantiate() if kwargs.get(\"instantiate\", True) else item
172 elif isinstance(item, ConfigExpression):
173 run_eval = kwargs.get(\"eval_expr\", True)
File /workspace/Code/MONAI/monai/bundle/config_item.py:298, in ConfigComponent.instantiate(self, **kwargs)
296 args = self.resolve_args()
297 args.update(kwargs)
--> 298 return instantiate(modname, mode, **args)
File /workspace/Code/MONAI/monai/utils/module.py:261, in instantiate(__path, __mode, **kwargs)
259 print('*****', component, '*****')
260 if component is None:
--> 261 raise ModuleNotFoundError(f\"Cannot locate class or function path: '{__path}'.\")
262 m = look_up_option(__mode, CompInitMode)
263 try:
ModuleNotFoundError: Cannot locate class or function path: 'RetinaNetDetector'."
}
To Reproduce
from monai.bundle import ConfigParser
!python -m monai.bundle download lung_nodule_ct_detection --bundle_dir "/workspace/Code/tutorials"
config = "/workspace/Code/tutorials/lung_nodule_ct_detection/configs/train.json"
bundle_config = ConfigParser()
bundle_config.read_config(config)
detector = bundle_config.get_parsed_content("detector", instantiate=True)
Metadata
Metadata
Assignees
Labels
No labels