mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-22 15:45:39 +08:00
Install completions for entrypoints, misc config tweaks (#569)
* Install completions for entrypoints, misc config tweaks * Bump dcargs
This commit is contained in:
1 parent
7c1734fe5c
commit
7f38490ec0
8 files changed
+65
-53
No files matched your search
@@ -240,7 +240,7 @@ class Config(PrintableConfig):
|
||||
"""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"""
|
||||
timestamp: str = datetime.now().strftime("%Y-%m-%d_%H%M%S")
|
||||
timestamp: str = "{timestamp}"
|
||||
"""Experiment timestamp."""
|
||||
machine: MachineConfig = MachineConfig()
|
||||
logging: LoggingConfig = LoggingConfig()
|
||||
@@ -256,6 +256,10 @@ class Config(PrintableConfig):
|
||||
}
|
||||
)
|
||||
|
||||
def set_timestamp(self) -> None:
|
||||
"""Dynamically set the experiment timestamp"""
|
||||
self.timestamp = datetime.now().strftime("%Y-%m-%d_%H%M%S")
|
||||
|
||||
def set_experiment_name(self) -> None:
|
||||
"""Dynamically set the experiment name"""
|
||||
if self.experiment_name is None:
|
||||
|
||||
@@ -18,11 +18,9 @@ Put all the method implementations in one location.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
from typing import Dict, Type
|
||||
from typing import Dict
|
||||
|
||||
import dcargs
|
||||
from typeguard import typeguard_ignore
|
||||
|
||||
from nerfactory.configs.base import (
|
||||
AdamOptimizerConfig,
|
||||
@@ -232,28 +230,7 @@ base_configs["tensorf"] = Config(
|
||||
)
|
||||
|
||||
|
||||
@typeguard_ignore # TypeGuard doesn't understand the generic alias that's returned here.
|
||||
def _make_base_config_subcommand_type() -> Type[Config]:
|
||||
"""Generate a Union[] type over the possible base config types, with runtime
|
||||
annotations containing default values. Used to generate CLIs.
|
||||
|
||||
Returns:
|
||||
An annotated Union type, which can be used to pick a base configuration.
|
||||
"""
|
||||
# When a base config is used to generate a CLI: replace the auto-generated timestamp
|
||||
# with {timestamp}. This makes the CLI helptext (and, for zsh, autocomplete
|
||||
# generation) consistent everytime you run a script with --help.
|
||||
#
|
||||
# Note that when a config is instantiated with dcargs.cli(), the __post_init__
|
||||
# called when the config is instantiated will set the correct timestamp.
|
||||
base_configs_placeholder_timestamp = {}
|
||||
for name, config in base_configs.items():
|
||||
base_configs_placeholder_timestamp[name] = copy.deepcopy(config)
|
||||
|
||||
return dcargs.extras.subcommand_type_from_defaults(base_configs_placeholder_timestamp)
|
||||
|
||||
|
||||
AnnotatedBaseConfigUnion = _make_base_config_subcommand_type()
|
||||
AnnotatedBaseConfigUnion = dcargs.extras.subcommand_type_from_defaults(base_configs)
|
||||
"""Union[] type over config types, annotated with default instances for use with
|
||||
dcargs.cli(). Allows the user to pick between one of several base configurations, and
|
||||
then override values in it."""
|
||||
Reference in new issue
Block a user