mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-01 13:28:59 +08:00
Config restructure (#283)
* starting docs for pipelines * working on an example * clearing output * starting to implement config changes and add documentation * wip: removed cicular imports; porting basic config into python; todo: get python setups workin * circular imports again * wip: pausing at dataloader sort of working * break for today * running vanilla * wip need to get all the config docs working * laptop about to die * instant ngp working * added all configs for all methods; not tested yet: [mipnerf360, nerfw, semantic_nerf] * unpacking later * done with pylinting * mostly done. just need to do docs and one test * added import order to docs * fixing near/far plane and other config things * making loggers also instantiable via configs * docs * lint * making --help work with dcargs * moving configs back into flat * convert list to tuples; fixed post init function with mutable params * lint * made run_eval and benchmarking scripts compatible with new config/dcargs * lint * added option to load configs from presaved config Co-authored-by: evonneng <evonne_ng@berkeley.edu>
This commit is contained in:
1 parent
e0856e3afc
commit
7e9a56fac4
46 files changed
+987
-916
No files matched your search
+22
-28
@@ -2,20 +2,21 @@
|
||||
"""
|
||||
Default test to make sure train runs
|
||||
"""
|
||||
import os
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from hydra import compose, initialize
|
||||
from hydra.core.global_hydra import GlobalHydra
|
||||
from omegaconf import DictConfig, open_dict
|
||||
|
||||
import nerfactory.configs.base as cfg
|
||||
from nerfactory.configs.base_configs import base_configs
|
||||
from nerfactory.engine.trainer import train_loop
|
||||
from nerfactory.utils.config import setup_config
|
||||
|
||||
BLACKLIST = ["graph_semantic_nerf.yaml", "graph_mipnerf_360.yaml", "graph_instant_ngp.yaml"]
|
||||
BLACKLIST = ["base", "semantic_nerf", "mipnerf_360", "instant_ngp"]
|
||||
|
||||
|
||||
def set_reduced_config(config: DictConfig):
|
||||
def set_reduced_config(config: cfg.Config):
|
||||
"""Reducing the config settings to speedup test"""
|
||||
config.machine.num_gpus = 0
|
||||
config.trainer.max_num_iterations = 2
|
||||
@@ -23,25 +24,21 @@ def set_reduced_config(config: DictConfig):
|
||||
# switch to using the vanilla ImageDataset class
|
||||
config.pipeline.dataloader.image_dataset_type = "rgb"
|
||||
|
||||
config.pipeline.dataloader.train_dataset = {
|
||||
"_target_": "nerfactory.dataloaders.datasets.Blender",
|
||||
"data_directory": "tests/data/lego_test",
|
||||
"downscale_factor": 16,
|
||||
}
|
||||
config.pipeline.dataloader.train_dataset = cfg.BlenderDatasetConfig(
|
||||
data_directory="tests/data/lego_test", downscale_factor=16
|
||||
)
|
||||
config.pipeline.dataloader.train_num_images_to_sample_from = 1
|
||||
config.pipeline.dataloader.train_num_rays_per_batch = 4
|
||||
with open_dict(config):
|
||||
config.pipeline.dataloader.eval_dataset = {
|
||||
"_target_": "nerfactory.dataloaders.datasets.Blender",
|
||||
"data_directory": "tests/data/lego_test",
|
||||
"downscale_factor": 16,
|
||||
}
|
||||
config.pipeline.dataloader.eval_dataset = cfg.BlenderDatasetConfig(
|
||||
data_directory="tests/data/lego_test", downscale_factor=16
|
||||
)
|
||||
|
||||
# reduce model factors
|
||||
config.pipeline.model.num_coarse_samples = 4
|
||||
config.pipeline.model.num_importance_samples = 4
|
||||
# set logging to tmp
|
||||
config.logging.writer.TensorboardWriter.log_dir = "/tmp/"
|
||||
for writer in config.logging.writer:
|
||||
writer.log_dir = Path("/tmp/")
|
||||
# remove viewer
|
||||
config.viewer.enable = False
|
||||
|
||||
@@ -55,20 +52,17 @@ def set_reduced_config(config: DictConfig):
|
||||
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
|
||||
def test_run_train():
|
||||
"""test run train script works properly"""
|
||||
all_configs = [f for f in os.listdir("configs/") if f.endswith(".yaml")] # relative to run path
|
||||
for config_path in all_configs:
|
||||
print(f"testing run for: {config_path}")
|
||||
if config_path in BLACKLIST:
|
||||
all_config_names = base_configs.keys()
|
||||
for config_name in all_config_names:
|
||||
if config_name in BLACKLIST:
|
||||
print("skipping", config_name)
|
||||
continue
|
||||
initialize(version_base="1.2", config_path="../configs/") # relative to test path
|
||||
config = compose(config_path)
|
||||
print(f"testing run for: {config_name}")
|
||||
config = base_configs[config_name]
|
||||
config = set_reduced_config(config)
|
||||
config = setup_config(config)
|
||||
|
||||
train_loop(local_rank=0, world_size=0, config=config)
|
||||
|
||||
GlobalHydra.instance().clear()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_run_train()
|
||||
Reference in new issue
Block a user