diff --git a/nerfstudio/plugins/registry.py b/nerfstudio/plugins/registry.py index f50550f74..380fab25f 100644 --- a/nerfstudio/plugins/registry.py +++ b/nerfstudio/plugins/registry.py @@ -41,6 +41,11 @@ def discover_methods() -> t.Tuple[t.Dict[str, TrainerConfig], t.Dict[str, str]]: discovered_entry_points = entry_points(group="nerfstudio.method_configs") for name in discovered_entry_points.names: spec = discovered_entry_points[name].load() + + # Support callable (function) entry points to avoid circular imports + if callable(spec): + spec = spec() + if not isinstance(spec, MethodSpecification): CONSOLE.print( f"[bold yellow]Warning: Could not entry point {spec} as it is not an instance of MethodSpecification" diff --git a/nerfstudio/plugins/registry_dataparser.py b/nerfstudio/plugins/registry_dataparser.py index 6b1e34a0f..1d7011356 100644 --- a/nerfstudio/plugins/registry_dataparser.py +++ b/nerfstudio/plugins/registry_dataparser.py @@ -57,6 +57,11 @@ def discover_dataparsers() -> t.Tuple[t.Dict[str, DataParserConfig], t.Dict[str, discovered_entry_points = entry_points(group="nerfstudio.dataparser_configs") for name in discovered_entry_points.names: spec = discovered_entry_points[name].load() + + # Support callable (function) entry points to avoid circular imports + if callable(spec): + spec = spec() + if not isinstance(spec, DataParserSpecification): CONSOLE.print( f"[bold yellow]Warning: Could not entry point {spec} as it is not an instance of DataParserSpecification"