mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-12 02:45:34 +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"""
|
||||
config.machine.device_type = "cpu"
|
||||
if hasattr(config.pipeline.model, "implementation"):
|
||||
@@ -56,11 +56,15 @@ def set_reduced_config(config: TrainerConfig):
|
||||
# remove viewer
|
||||
config.viewer.quit_on_train_completion = True
|
||||
|
||||
# timestamp & output directory
|
||||
config.set_timestamp()
|
||||
config.output_dir = tmp_path / "outputs"
|
||||
|
||||
return config
|
||||
|
||||
|
||||
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
|
||||
def test_train():
|
||||
def test_train(tmp_path: Path):
|
||||
"""test run train script works properly"""
|
||||
all_config_names = method_configs.keys()
|
||||
for config_name in all_config_names:
|
||||
@@ -69,16 +73,16 @@ def test_train():
|
||||
continue
|
||||
print(f"testing run for: {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)
|
||||
|
||||
|
||||
def test_simple_io():
|
||||
def test_simple_io(tmp_path: Path):
|
||||
"""test to check minimal data IO works correctly"""
|
||||
config = method_configs["vanilla-nerf"]
|
||||
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)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user