mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 14:28:41 +08:00
Specify path for test outputs (#2400)
* test_train - set_timestamp, output_dir in pytest tmp_path * test_train typehints
This commit is contained in:
1 parent
4d0033343c
commit
d947aee713
1 file changed
+9
-5
+9
-5
@@ -29,7 +29,7 @@ BLACKLIST = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def set_reduced_config(config: TrainerConfig):
|
def set_reduced_config(config: TrainerConfig, tmp_path: Path):
|
||||||
"""Reducing the config settings to speedup test"""
|
"""Reducing the config settings to speedup test"""
|
||||||
config.machine.device_type = "cpu"
|
config.machine.device_type = "cpu"
|
||||||
if hasattr(config.pipeline.model, "implementation"):
|
if hasattr(config.pipeline.model, "implementation"):
|
||||||
@@ -56,11 +56,15 @@ def set_reduced_config(config: TrainerConfig):
|
|||||||
# remove viewer
|
# remove viewer
|
||||||
config.viewer.quit_on_train_completion = True
|
config.viewer.quit_on_train_completion = True
|
||||||
|
|
||||||
|
# timestamp & output directory
|
||||||
|
config.set_timestamp()
|
||||||
|
config.output_dir = tmp_path / "outputs"
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
|
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
|
||||||
def test_train():
|
def test_train(tmp_path: Path):
|
||||||
"""test run train script works properly"""
|
"""test run train script works properly"""
|
||||||
all_config_names = method_configs.keys()
|
all_config_names = method_configs.keys()
|
||||||
for config_name in all_config_names:
|
for config_name in all_config_names:
|
||||||
@@ -69,16 +73,16 @@ def test_train():
|
|||||||
continue
|
continue
|
||||||
print(f"testing run for: {config_name}")
|
print(f"testing run for: {config_name}")
|
||||||
config = method_configs[config_name]
|
config = method_configs[config_name]
|
||||||
config = set_reduced_config(config)
|
config = set_reduced_config(config, tmp_path)
|
||||||
|
|
||||||
train_loop(local_rank=0, world_size=0, config=config)
|
train_loop(local_rank=0, world_size=0, config=config)
|
||||||
|
|
||||||
|
|
||||||
def test_simple_io():
|
def test_simple_io(tmp_path: Path):
|
||||||
"""test to check minimal data IO works correctly"""
|
"""test to check minimal data IO works correctly"""
|
||||||
config = method_configs["vanilla-nerf"]
|
config = method_configs["vanilla-nerf"]
|
||||||
config.pipeline.datamanager.dataparser = MinimalDataParserConfig(data=Path("tests/data/minimal_parser"))
|
config.pipeline.datamanager.dataparser = MinimalDataParserConfig(data=Path("tests/data/minimal_parser"))
|
||||||
config = set_reduced_config(config)
|
config = set_reduced_config(config, tmp_path)
|
||||||
train_loop(local_rank=0, world_size=0, config=config)
|
train_loop(local_rank=0, world_size=0, config=config)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user