specify a viewers list (#574)

* viewer list

* before master merge

* update script
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-09-28 10:10:18 -07:00
1 parent c733d1a4ed
commit 43d588f35f
8 files changed
+55 -39

No files matched your search

+15 -6
View File
@@ -17,7 +17,7 @@
from __future__ import annotations
import logging
from dataclasses import dataclass
from dataclasses import dataclass, field
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Literal, Optional, Tuple, Type
@@ -118,8 +118,6 @@ class LoggingConfig(PrintableConfig):
max_buffer_size: int = 20
"""maximum history size to keep for computing running averages of stats.
e.g. if 20, averages will be computed over past 20 occurances."""
event_writer: Literal["tb", "wandb", "none"] = "wandb"
"""specify which writer to use (tensorboard or wandb)"""
local_writer: LocalWriterConfig = LocalWriterConfig(enable=True)
"""if provided, will print stats locally. if None, will disable printing"""
enable_profiler: bool = True
@@ -154,7 +152,6 @@ class TrainerConfig(PrintableConfig):
load_step: Optional[int] = None
"""optionally specify model step to load from; if none, will find most recent model in load_dir"""
load_config: Optional[Path] = None
"""optionally specify a pre-defined config to load from"""
# Viewer related configs
@@ -162,8 +159,6 @@ class TrainerConfig(PrintableConfig):
class ViewerConfig(PrintableConfig):
"""Configuration for viewer instantiation"""
enable: bool = False
"""whether to enable viewer"""
relative_log_filename: str = "viewer_log_filename.txt"
"""Filename to use for the log file."""
start_train: bool = True
@@ -255,6 +250,20 @@ class Config(PrintableConfig):
}
}
)
"""optionally specify a pre-defined config to load from"""
vis: List[Literal["viewer", "wandb", "tensorboard"]] = field(default_factory=lambda: ["wandb"])
def is_viewer_enabled(self) -> bool:
"""Checks if a viewer is enabled."""
return "viewer" in self.vis
def is_wandb_enabled(self) -> bool:
"""Checks if wandb is enabled."""
return "wandb" in self.vis
def is_tensorboard_enabled(self) -> bool:
"""Checks if tensorboard is enabled."""
return "tensorboard" in self.vis
def set_timestamp(self) -> None:
"""Dynamically set the experiment timestamp"""