mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-22 23:55:36 +08:00
specify a viewers list (#574)
* viewer list * before master merge * update script
This commit is contained in:
1 parent
c733d1a4ed
commit
43d588f35f
8 files changed
+55
-39
No files matched your search
@@ -54,7 +54,7 @@ def check_viewer_enabled(func: Callable) -> Callable:
|
||||
|
||||
def wrapper(self, *args, **kwargs):
|
||||
ret = None
|
||||
if self.config.viewer.enable:
|
||||
if self.config.is_viewer_enabled():
|
||||
ret = func(self, *args, **kwargs)
|
||||
return ret
|
||||
|
||||
@@ -66,7 +66,7 @@ def check_eval_enabled(func: Callable) -> Callable:
|
||||
|
||||
def wrapper(self, *args, **kwargs):
|
||||
ret = None
|
||||
if self.config.logging.event_writer != "none":
|
||||
if self.config.is_wandb_enabled() or self.config.is_tensorboard_enabled():
|
||||
ret = func(self, *args, **kwargs)
|
||||
return ret
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import torch
|
||||
import wandb
|
||||
from rich import console
|
||||
from torch.utils.tensorboard import SummaryWriter
|
||||
from torchtyping import TensorType
|
||||
|
||||
@@ -33,6 +34,8 @@ from nerfactory.configs import base as cfg
|
||||
from nerfactory.utils.decorators import check_main_thread, decorate_all
|
||||
from nerfactory.utils.misc import human_format
|
||||
|
||||
CONSOLE = console.Console()
|
||||
|
||||
to8b = lambda x: (255 * torch.clamp(x, min=0, max=1)).to(torch.uint8)
|
||||
EVENT_WRITERS = []
|
||||
EVENT_STORAGE = []
|
||||
@@ -187,7 +190,7 @@ def setup_local_writer(config: cfg.LoggingConfig, max_iter: int, banner_messages
|
||||
GLOBAL_BUFFER["events"] = {}
|
||||
|
||||
|
||||
def setup_event_writer(config: cfg.LoggingConfig, log_dir: Path) -> None:
|
||||
def setup_event_writer(config: cfg.Config, log_dir: Path) -> None:
|
||||
"""Initialization of all event writers specified in config
|
||||
|
||||
Args:
|
||||
@@ -195,15 +198,20 @@ def setup_event_writer(config: cfg.LoggingConfig, log_dir: Path) -> None:
|
||||
max_iter: maximum number of train iterations
|
||||
banner_messages: list of messages to always display at bottom of screen
|
||||
"""
|
||||
if config.event_writer == "tb":
|
||||
curr_writer = TensorboardWriter(log_dir=log_dir)
|
||||
elif config.event_writer == "wandb":
|
||||
using_event_writer = False
|
||||
if config.is_wandb_enabled():
|
||||
curr_writer = WandbWriter(log_dir=log_dir)
|
||||
EVENT_WRITERS.append(curr_writer)
|
||||
using_event_writer = True
|
||||
if config.is_tensorboard_enabled():
|
||||
curr_writer = TensorboardWriter(log_dir=log_dir)
|
||||
EVENT_WRITERS.append(curr_writer)
|
||||
using_event_writer = True
|
||||
if using_event_writer:
|
||||
string = f"logging events to: {log_dir}"
|
||||
else:
|
||||
logging.info("disabled tensorboard/wandb event writers")
|
||||
return
|
||||
EVENT_WRITERS.append(curr_writer)
|
||||
logging.info("logging %s events to: %s", config.event_writer, log_dir)
|
||||
string = "disabled tensorboard/wandb event writers"
|
||||
CONSOLE.print(f"[bold red]{string}")
|
||||
|
||||
|
||||
class Writer:
|
||||
|
||||
Reference in new issue
Block a user