Skip to content

Commit

Permalink
Support python 3.7 (#77)
Browse files Browse the repository at this point in the history
* Support python 3.7

* Add dependency
  • Loading branch information
tancik authored Oct 18, 2022
1 parent 62e70d3 commit 934f5e9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/train_mlp_dnerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
elapsed_time = time.time() - tic
loss = F.mse_loss(rgb[alive_ray_mask], pixels[alive_ray_mask])
print(
f"elapsed_time={elapsed_time:.2f}s | {step=} | "
f"elapsed_time={elapsed_time:.2f}s | step={step} | "
f"loss={loss:.5f} | "
f"alive_ray_mask={alive_ray_mask.long().sum():d} | "
f"n_rendering_samples={n_rendering_samples:d} | num_rays={len(pixels):d} |"
Expand Down Expand Up @@ -235,7 +235,7 @@
# )
# break
psnr_avg = sum(psnrs) / len(psnrs)
print(f"evaluation: {psnr_avg=}")
print(f"evaluation: psnr_avg={psnr_avg}")
train_dataset.training = True

if step == max_steps:
Expand Down
4 changes: 2 additions & 2 deletions examples/train_mlp_nerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
elapsed_time = time.time() - tic
loss = F.mse_loss(rgb[alive_ray_mask], pixels[alive_ray_mask])
print(
f"elapsed_time={elapsed_time:.2f}s | {step=} | "
f"elapsed_time={elapsed_time:.2f}s | step={step} | "
f"loss={loss:.5f} | "
f"alive_ray_mask={alive_ray_mask.long().sum():d} | "
f"n_rendering_samples={n_rendering_samples:d} | num_rays={len(pixels):d} |"
Expand Down Expand Up @@ -257,7 +257,7 @@
# )
# break
psnr_avg = sum(psnrs) / len(psnrs)
print(f"evaluation: {psnr_avg=}")
print(f"evaluation: psnr_avg={psnr_avg}")
train_dataset.training = True

if step == max_steps:
Expand Down
4 changes: 2 additions & 2 deletions examples/train_ngp_nerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def occ_eval_fn(x):
elapsed_time = time.time() - tic
loss = F.mse_loss(rgb[alive_ray_mask], pixels[alive_ray_mask])
print(
f"elapsed_time={elapsed_time:.2f}s | {step=} | "
f"elapsed_time={elapsed_time:.2f}s | step={step} | "
f"loss={loss:.5f} | "
f"alive_ray_mask={alive_ray_mask.long().sum():d} | "
f"n_rendering_samples={n_rendering_samples:d} | num_rays={len(pixels):d} |"
Expand Down Expand Up @@ -301,7 +301,7 @@ def occ_eval_fn(x):
# )
# break
psnr_avg = sum(psnrs) / len(psnrs)
print(f"evaluation: {psnr_avg=}")
print(f"evaluation: psnr_avg={psnr_avg}")
train_dataset.training = True

if step == max_steps:
Expand Down
6 changes: 5 additions & 1 deletion nerfacc/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""
Copyright (c) 2022 Ruilong Li, UC Berkeley.
"""
from importlib.metadata import version
try:
from importlib.metadata import version
except ImportError:
# Running on pre-3.8 Python; use importlib-metadata package
from importlib_metadata import version

__version__ = version("nerfacc")
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ description = "A General NeRF Acceleration Toolbox."
readme = "README.md"
authors = [{name = "Ruilong", email = "[email protected]"}]
license = { text="MIT" }
requires-python = ">=3.8"
requires-python = ">=3.7"
dependencies = [
"importlib_metadata>=5.0.0; python_version<'3.8'",
"ninja>=1.10.2.3",
"pybind11>=2.10.0",
"torch>=1.12.0",
Expand Down

0 comments on commit 934f5e9

Please sign in to comment.