Config suggestions (#300)

* Config suggestions

* Add some TODO notes
This commit is contained in:
Brent Yi authored and GitHub committed 2022-08-29 17:07:33 -07:00
1 parent edf9f59940
commit fe5f46c0aa
9 files changed
+115 -118

No files matched your search

+2 -9
View File
@@ -24,20 +24,14 @@ from typing import Any, Dict, TypeVar
import dcargs
from nerfactory.configs import base as cfg
T = TypeVar("T")
def cli_from_base_configs(base_library: Dict[str, T], eval_mode=False) -> T:
def cli_from_base_configs(base_library: Dict[str, T]) -> T:
"""Populate an instance of `cls`, where the first positional argument is used to
select from a library of named base configs. See
https://brentyi.github.io/dcargs/examples/06_base_configs/ for more details."""
if eval_mode:
for _, v in base_library.items():
v.eval = cfg.EvalConfig()
# Get base configuration name from the first positional argument.
if len(sys.argv) < 2 or sys.argv[1] not in base_library:
valid_usages = map(lambda k: f"{sys.argv[0]} {k} --help", base_library.keys())
@@ -52,8 +46,7 @@ def cli_from_base_configs(base_library: Dict[str, T], eval_mode=False) -> T:
args=sys.argv[2:],
default_instance=default_instance,
# `avoid_subparsers` will avoid making a subparser for unions when a default is
# provided; in this case, it simplifies our CLI but makes it less expressive
# (cannot switch away from the base optimizer types).
# provided; in this case, it simplifies our CLI but makes it less expressive.
avoid_subparsers=True,
)