auto set experiment name (#484)

changed experiment/method name requirements
This commit is contained in:
evonneng authored and GitHub committed 2022-09-19 13:05:45 -07:00
1 parent c2a2b1de1e
commit 211515c633
3 files changed
+16 -12

No files matched your search

+13 -7
View File
@@ -92,7 +92,7 @@ class TensorboardWriterConfig(InstantiateConfig):
_target: Type = writer.TensorboardWriter
"""target class to instantiate"""
log_dir: dcargs.conf.Fixed[Path] = dcargs.MISSING
"""auto-populated absolute path to saved tensorboard events"""
"""[Do not set] Auto-populated absolute path to saved tensorboard events"""
@dataclass
@@ -102,7 +102,7 @@ class WandbWriterConfig(InstantiateConfig):
_target: Type = writer.WandbWriter
"""target class to instantiate"""
log_dir: dcargs.conf.Fixed[Path] = dcargs.MISSING
"""auto-populated absolute path to saved wandb events"""
"""[Do not set] Auto-populated absolute path to saved wandb events"""
@dataclass
@@ -147,7 +147,7 @@ class LoggingConfig(PrintableConfig):
event_writer: Literal["tb", "wandb", "none"] = "wandb"
"""specify which writer to use (tensorboard or wandb)"""
event_writer_config: dcargs.conf.Fixed[Optional[Union[TensorboardWriterConfig, WandbWriterConfig]]] = dcargs.MISSING
"""dynamically set the writer config based on the writer"""
"""[Do not set] Writer config based on the specified event_writer. Set automatically."""
local_writer: LocalWriterConfig = LocalWriterConfig(enable=True)
"""if provided, will print stats locally. if None, will disable printing"""
enable_profiler: bool = True
@@ -175,7 +175,7 @@ class TrainerConfig(PrintableConfig):
relative_model_dir: Path = Path("nerfactory_models/")
"""relative path to save all checkpoints"""
model_dir: dcargs.conf.Fixed[Path] = dcargs.MISSING
"""auto-populated absolute path to saved checkpoints"""
"""[Do not set] Auto-populated absolute path to saved checkpoints. Set automatically."""
# optional parameters if we want to resume training
load_dir: Optional[Path] = None
"""optionally specify a pre-trained model directory to load from"""
@@ -396,10 +396,12 @@ class SchedulerConfig(InstantiateConfig):
class Config(PrintableConfig):
"""Full config contents"""
experiment_name: str = "blender_lego"
method_name: str = "base_method"
method_name: Optional[str] = None
"""Method name. Required to set in python or via cli"""
experiment_name: Optional[str] = None
"""Experiment name. If None, will automatically be set to dataset name"""
base_dir: dcargs.conf.Fixed[Path] = dcargs.MISSING
"""Experiment base directory. Set automatically."""
"""[Do not set] Experiment base directory. Set automatically."""
machine: MachineConfig = MachineConfig()
logging: LoggingConfig = LoggingConfig()
viewer: ViewerConfig = ViewerConfig()
@@ -425,6 +427,10 @@ class Config(PrintableConfig):
timestamp: Timestamp to use, as a string. If None, defaults to the current
time in the form YYYY-MM-DD_HHMMMSS.
"""
# check the experiment and method names
assert self.method_name is not None, "Please set method name in config or via the cli"
if self.experiment_name is None:
self.experiment_name = str(self.pipeline.datamanager.train_dataparser.data_directory).replace("/", "-")
# set the timestamp of the model logging/writer loggign paths
if timestamp is None:
+2 -4
View File
@@ -64,7 +64,6 @@ base_configs["instant-ngp"] = Config(
)
base_configs["mipnerf-360"] = Config(
experiment_name="mipnerf-360",
method_name="mipnerf-360",
trainer=TrainerConfig(steps_per_eval_batch=200),
pipeline=PipelineConfig(
@@ -97,7 +96,6 @@ base_configs["mipnerf"] = Config(
)
base_configs["nerfw"] = Config(
experiment_name="friends_TBBT-big_living_room",
method_name="nerfw",
pipeline=PipelineConfig(
datamanager=VanillaDataManagerConfig(
@@ -107,8 +105,8 @@ base_configs["nerfw"] = Config(
),
)
base_configs["semantic-nerf"] = Config(
experiment_name="friends_TBBT-big_living_room",
method_name="semantic-nerf",
pipeline=PipelineConfig(
datamanager=VanillaDataManagerConfig(
@@ -193,7 +191,7 @@ def _make_base_config_subcommand_type() -> Type[Config]:
base_configs_placeholder_timestamp = {}
for name, config in base_configs.items():
base_configs_placeholder_timestamp[name] = copy.deepcopy(config)
base_configs_placeholder_timestamp[name].populate_dynamic_fields("{timestamp}")
base_configs_placeholder_timestamp[name].populate_dynamic_fields(timestamp="{timestamp}")
return dcargs.extras.subcommand_type_from_defaults(base_configs_placeholder_timestamp)
+1 -1
View File
@@ -381,7 +381,7 @@ class LocalWriter:
if step > 0:
if not self.has_printed and self.config.max_log_size:
logging.info(
"\x1b[33;20mPrinting max of %d lines. Set flag `--logging.local_writer.max-log-size=0` "
"\x1b[33;20mPrinting max of %d lines. Set flag `--logging.local-writer.max-log-size=0` "
"to disable line wrapping.\x1b[0m",
self.config.max_log_size,
)