Fix import error when tcnn installed but CUDA runtime not available (#2429)

This commit is contained in:
Jonáš Kulhánek authored and GitHub committed 2023-09-15 17:18:23 -04:00
1 parent 7269a7ee16
commit ef2fd3dbe1
6 files changed
+68 -26

No files matched your search

+3 -4
View File
@@ -5,15 +5,14 @@ import torch
from nerfstudio.cameras.rays import Frustums, RaySamples
from nerfstudio.fields.nerfacto_field import NerfactoField
from nerfstudio.utils.external import TCNN_EXISTS, tcnn_import_exception
def test_nerfacto_field():
"""Test the Nerfacto field"""
try:
import tinycudann as tcnn # noqa: F401
except ModuleNotFoundError as e:
if not TCNN_EXISTS:
# tinycudann module doesn't exist
print(e)
print(tcnn_import_exception)
return
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
aabb_scale = 1.0