mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
test configs are loadable
Summary: Add test that the yaml files deserialize. Reviewed By: davnov134 Differential Revision: D36830673 fbshipit-source-id: b785d8db97b676686036760bfa2dd3fa638bda57
This commit is contained in:
parent
c0f88e04a0
commit
023a2369ae
@ -708,9 +708,8 @@ class ExperimentConfig(Configurable):
|
||||
|
||||
expand_args_fields(ExperimentConfig)
|
||||
|
||||
if __name__ == "__main__":
|
||||
cs = hydra.core.config_store.ConfigStore.instance()
|
||||
cs.store(name="default_config", node=ExperimentConfig)
|
||||
cs = hydra.core.config_store.ConfigStore.instance()
|
||||
cs.store(name="default_config", node=ExperimentConfig)
|
||||
|
||||
|
||||
@hydra.main(config_path="./configs/", config_name="default_config")
|
||||
|
@ -10,6 +10,7 @@ from pathlib import Path
|
||||
|
||||
import experiment
|
||||
import torch
|
||||
from hydra import compose, initialize_config_dir
|
||||
from omegaconf import OmegaConf
|
||||
|
||||
|
||||
@ -23,6 +24,7 @@ def interactive_testing_requested() -> bool:
|
||||
|
||||
|
||||
DATA_DIR = Path(__file__).resolve().parent
|
||||
IMPLICITRON_CONFIGS_DIR = Path(__file__).resolve().parent.parent / "configs"
|
||||
DEBUG: bool = False
|
||||
|
||||
# TODO:
|
||||
@ -65,3 +67,20 @@ class TestExperiment(unittest.TestCase):
|
||||
if DEBUG:
|
||||
(DATA_DIR / "experiment.yaml").write_text(yaml)
|
||||
self.assertEqual(yaml, (DATA_DIR / "experiment.yaml").read_text())
|
||||
|
||||
def test_load_configs(self):
|
||||
config_files = []
|
||||
|
||||
for pattern in ("repro_singleseq*.yaml", "repro_multiseq*.yaml"):
|
||||
config_files.extend(
|
||||
[
|
||||
f
|
||||
for f in IMPLICITRON_CONFIGS_DIR.glob(pattern)
|
||||
if not f.name.endswith("_base.yaml")
|
||||
]
|
||||
)
|
||||
|
||||
for file in config_files:
|
||||
with self.subTest(file.name):
|
||||
with initialize_config_dir(config_dir=str(IMPLICITRON_CONFIGS_DIR)):
|
||||
compose(file.name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user