mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-20 22:56:03 +08:00
1 parent
ad706f59c4
commit
081bf82bf5
4 files changed
+36
-34
No files matched your search
+10
-11
@@ -18,7 +18,6 @@ Generic Writer class
|
||||
from __future__ import annotations
|
||||
|
||||
import enum
|
||||
import os
|
||||
from abc import abstractmethod
|
||||
from pathlib import Path
|
||||
from time import time
|
||||
@@ -188,9 +187,14 @@ def setup_local_writer(config: cfg.LoggingConfig, max_iter: int, banner_messages
|
||||
|
||||
|
||||
@check_main_thread
|
||||
def setup_event_writer(is_wandb_enabled: bool, is_tensorboard_enabled: bool, log_dir: Path) -> None:
|
||||
def setup_event_writer(
|
||||
is_wandb_enabled: bool,
|
||||
is_tensorboard_enabled: bool,
|
||||
log_dir: Path,
|
||||
experiment_name: str,
|
||||
project_name: str = "nerfstudio-project",
|
||||
) -> None:
|
||||
"""Initialization of all event writers specified in config
|
||||
|
||||
Args:
|
||||
config: configuration to instantiate loggers
|
||||
max_iter: maximum number of train iterations
|
||||
@@ -198,7 +202,7 @@ def setup_event_writer(is_wandb_enabled: bool, is_tensorboard_enabled: bool, log
|
||||
"""
|
||||
using_event_writer = False
|
||||
if is_wandb_enabled:
|
||||
curr_writer = WandbWriter(log_dir=log_dir)
|
||||
curr_writer = WandbWriter(log_dir=log_dir, experiment_name=experiment_name, project_name=project_name)
|
||||
EVENT_WRITERS.append(curr_writer)
|
||||
using_event_writer = True
|
||||
if is_tensorboard_enabled:
|
||||
@@ -282,13 +286,8 @@ class TimeWriter:
|
||||
class WandbWriter(Writer):
|
||||
"""WandDB Writer Class"""
|
||||
|
||||
def __init__(self, log_dir: Path):
|
||||
wandb.init(
|
||||
project=os.environ.get("WANDB_PROJECT", "nerfstudio-project"),
|
||||
dir=os.environ.get("WANDB_DIR", str(log_dir)),
|
||||
name=os.environ.get("WANDB_NAME", log_dir.name),
|
||||
reinit=True,
|
||||
)
|
||||
def __init__(self, log_dir: Path, experiment_name: str, project_name: str = "nerfstudio-project"):
|
||||
wandb.init(project=project_name, dir=str(log_dir), reinit=True, name=experiment_name)
|
||||
|
||||
def write_image(self, name: str, image: TensorType["H", "W", "C"], step: int) -> None:
|
||||
image = torch.permute(image, (2, 0, 1))
|
||||
|
||||
Reference in new issue
Block a user