mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 05:48:57 +08:00
Added timing logic within trainer class (#37)
* added skeleton for terminal logger * done skeleton terminal writer logic... todo: actual calls to the write classes * moved lambda to top function * added logic to support timing
This commit is contained in:
1 parent
0dcf2ae599
commit
ca76f70d49
2 files changed
+53
-27
No files matched your search
@@ -40,19 +40,6 @@ class Writer:
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@check_main_thread
|
||||
def write_text(self, name: str, x: str, step: int, group: str = None, prefix: str = None) -> None:
|
||||
"""Required method to write a string to summary
|
||||
|
||||
Args:
|
||||
name (str): data identifier
|
||||
x (str): string to write
|
||||
step (int): the time step to log
|
||||
group (str): the group e.g., "Loss", "Accuracy", "Time"
|
||||
prefix (str): the prefix e.g., "train-", "test-"
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def write_scalar(self, name: str, scalar: float, step: int, group: str = None, prefix: str = None) -> None:
|
||||
"""Required method to write a single scalar value to the logger
|
||||
@@ -129,15 +116,6 @@ class LocalWriter(Writer):
|
||||
image_path = os.path.join(self.save_dir, f"{name}.jpg")
|
||||
imageio.imwrite(image_path, np.uint8(x.cpu().numpy() * 255.0))
|
||||
|
||||
@check_main_thread
|
||||
def write_text(self, name: str, x: str, step: int, group: str = None, prefix: str = None) -> None:
|
||||
"""Logs text locally to the terminal in place
|
||||
Args:
|
||||
name (str): data identifier
|
||||
x (str): string to write
|
||||
"""
|
||||
print(f"{name}: {x}, step: {step}", end="\r")
|
||||
|
||||
@check_main_thread
|
||||
def write_scalar(self, name: str, scalar: float, step: int, group: str = None, prefix: str = None) -> None:
|
||||
self.write_text(name, f"scalar: {scalar:04f}", step)
|
||||
raise NotImplementedError
|
||||
Reference in new issue
Block a user