mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 06:18:44 +08:00
refactor moving setup functions to associated classes; cleanup eval and benchmark scripts (#48)
* refactor code to move graph/dataset setup to respective files * consolidated eval and benchmark script * moved setup optimizers to its own thing
This commit is contained in:
1 parent
ee60d5b9b5
commit
f67dca6f5b
10 files changed
+269
-217
No files matched your search
+10
-8
@@ -195,10 +195,11 @@ class Writer:
|
||||
class TimeWriter:
|
||||
"""Timer context manager that calculates duration around wrapped functions"""
|
||||
|
||||
def __init__(self, writer, name, step=None):
|
||||
def __init__(self, writer, name, step=None, write=True):
|
||||
self.writer = writer
|
||||
self.name = name
|
||||
self.step = step
|
||||
self.write = write
|
||||
|
||||
self.start = None
|
||||
self.duration = None
|
||||
@@ -210,13 +211,14 @@ class TimeWriter:
|
||||
def __exit__(self, *args):
|
||||
self.duration = time() - self.start
|
||||
update_step = self.step is not None
|
||||
self.writer.put_time(
|
||||
name=self.name,
|
||||
duration=self.duration,
|
||||
step=self.step if update_step else GLOBAL_BUFFER["max_iter"],
|
||||
avg_over_steps=update_step,
|
||||
update_eta=self.name == EventName.ITER_TRAIN_TIME,
|
||||
)
|
||||
if self.write:
|
||||
self.writer.put_time(
|
||||
name=self.name,
|
||||
duration=self.duration,
|
||||
step=self.step if update_step else GLOBAL_BUFFER["max_iter"],
|
||||
avg_over_steps=update_step,
|
||||
update_eta=self.name == EventName.ITER_TRAIN_TIME,
|
||||
)
|
||||
|
||||
|
||||
@decorate_all([check_main_thread])
|
||||
|
||||
Reference in new issue
Block a user