Respect wandb environment variables (#1738)

This commit is contained in:
Jonáš Kulhánek authored and GitHub committed 2023-04-14 16:28:00 +02:00
1 parent 8126d47d8c
commit 6c8739ece2
1 file changed
+7 -1
+7 -1
View File
@@ -18,6 +18,7 @@ Generic Writer class
from __future__ import annotations from __future__ import annotations
import enum import enum
import os
from abc import abstractmethod from abc import abstractmethod
from pathlib import Path from pathlib import Path
from time import time from time import time
@@ -283,7 +284,12 @@ class WandbWriter(Writer):
"""WandDB Writer Class""" """WandDB Writer Class"""
def __init__(self, log_dir: Path): def __init__(self, log_dir: Path):
wandb.init(project="nerfstudio-project", dir=str(log_dir), reinit=True, name=log_dir.name) 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 write_image(self, name: str, image: TensorType["H", "W", "C"], step: int) -> None: def write_image(self, name: str, image: TensorType["H", "W", "C"], step: int) -> None:
image = torch.permute(image, (2, 0, 1)) image = torch.permute(image, (2, 0, 1))