Skip to content

Fix _LazyError attribute lookup when tinycudann is unavailable - #3808

Open
M-Colley wants to merge 1 commit into
nerfstudio-project:mainfrom
M-Colley:fix/issue-3751-lazy-error
Open

M-Colley wants to merge 1 commit into
nerfstudio-project:mainfrom
M-Colley:fix/issue-3751-lazy-error

Conversation

@M-Colley

Copy link
Copy Markdown
Contributor

Fixes #3751.

nerfstudio.utils.external wraps failed tinycudann imports in _LazyError. Accessing tcnn.Encoding raises AttributeError: '_LazyError' object has no attribute '__data' because Python name-mangles self.__data and object.__getattribute__ looks up "__data". In addition, LazyErrorObj.__call__ and LazyErrorObj.__getattr__ unpack a (name, exc) tuple, and external.py passes the bare tcnn_import_exception object to _LazyError.

This patch stores the tuple payload in self._data on _LazyError and LazyErrorObj, and initializes tcnn with ("tinycudann", tcnn_import_exception). Calling tcnn.Encoding(...) or accessing nested attributes on tcnn then raises RuntimeError("Could not load package tinycudann.") chained from the underlying import error. Regression tests in tests/utils/test_external.py verify _LazyError directly and test reloading nerfstudio.utils.external when tinycudann is absent.

Signed-off-by: Mark Colley <39366189+M-Colley@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

neus-facto training fails on SDF studio data: _LazyError object has no attribute __data

1 participant