Merge branch 'master' of github.com:ethanweber/mattport

This commit is contained in:
evonneng committed 2022-05-18 22:33:13 +00:00
commit 1f719b49c0
75 files changed
+22314 -8752

No files matched your search

+1 -1
View File
@@ -56,7 +56,7 @@ def main():
trainer = Trainer(config, local_rank=0, world_size=1)
trainer.setup(test_mode=True)
avg_psnr = 0
for step, image_idx in enumerate(config.data.validation_image_indices):
for step, image_idx in enumerate(config.data.val_image_indices):
with torch.no_grad():
psnr = trainer.test_image(image_idx=image_idx, step=step)
avg_psnr = (step * avg_psnr + psnr) / (step + 1)
+2 -5
View File
@@ -12,11 +12,8 @@ if __name__ == "__main__":
for step in steps:
if "name" in step and step["name"] in LOCAL_TESTS:
if step["name"] == "Run Black":
curr_command = f"black mattport/ {step['with']['options']};"
else:
compressed = step["run"].replace("\n", "").replace("\\", "")
curr_command = f"{compressed};"
compressed = step["run"].replace("\n", ";").replace("\\", "")
curr_command = f"{compressed}"
print("*" * 100)
print(f"Running {curr_command}")
+6 -2
View File
@@ -6,6 +6,7 @@ import logging
import random
import socket
from datetime import timedelta
import traceback
from typing import Any, Callable
import hydra
@@ -17,6 +18,7 @@ from omegaconf import DictConfig
from mattport.nerf.trainer import Trainer
from mattport.utils import comms, profiler
from time import time
logging.basicConfig(format="[%(filename)s:%(lineno)d] %(message)s", level=logging.DEBUG)
@@ -98,7 +100,7 @@ def _distributed_worker(
assert num_gpus_per_machine <= torch.cuda.device_count()
torch.cuda.set_device(local_rank)
_set_random_seed(1234 + local_rank) # NOTE(ethan): will this work for multiple machines? should we use global_rank?
_set_random_seed(1234 + global_rank)
comms.synchronize(world_size)
output = main_func(local_rank, world_size, config)
@@ -147,13 +149,15 @@ def launch(
world_size = num_machines * num_gpus_per_machine
if world_size == 0:
# Using only CPU and one process.
_set_random_seed(0)
main_func(local_rank=0, world_size=0, config=config)
elif world_size == 1:
# Using one gpu and one process.
_set_random_seed(0)
try:
main_func(local_rank=0, world_size=1, config=config)
except KeyboardInterrupt:
pass
print(traceback.format_exc())
finally:
profiler.flush_profiler(config.logging)
elif world_size > 1: