mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-12 02:45:34 +08:00
* Model class done, pipeline class still needs more visualization stuffs * Renaming the BaseDataContainer to DataloaderOutputs and adding documentation * Pushing more documentation, removing some trivial functions * Updating dict typing * Removing config dicts for collider * Passing tests * Pushing shell new dataloader * Saving work, need to fix NGP model's get_loss_dict and Pipeline * V1 of the ngp pipeline should be done. Need train script and debugging * Updating with latest instant-ngp code * Syntax updates from latest ngp graph code * Linter, removing unneeded code in new NGP graph code * Style * Should be good now. Linter is happy and the code is verbatum current instant-ngp * Everything done except novel view testing code * Fixing some nitpicks * Debugging dataloader * merged master * WOP. integrating pipeline with configs and notebook demo * removing model folder * a lot of name changing from Graph to Model * in progress... changing trainer to use pipeline... broken right now * pipeline code runs * switched to val dataset * makes run_eval.py work * updated configs for pipeline change * fixing test_run_train script * fixing black and linting * fix docs * small updates to trainer Co-authored-by: Jake Austin <jake-austin@berkeley.edu>
71 lines
2.3 KiB
Python
71 lines
2.3 KiB
Python
# pylint: disable=protected-access
|
|
"""
|
|
Default test to make sure train runs
|
|
"""
|
|
import os
|
|
|
|
import pytest
|
|
from hydra import compose, initialize
|
|
from hydra.core.global_hydra import GlobalHydra
|
|
from omegaconf import DictConfig
|
|
|
|
from scripts.run_train import main
|
|
|
|
BLACKLIST = ["graph_semantic_nerf.yaml", "graph_mipnerf_360.yaml", "graph_instant_ngp.yaml"]
|
|
|
|
|
|
def set_reduced_config(config: DictConfig):
|
|
"""Reducing the config settings to speedup test"""
|
|
config.machine.num_gpus = 0
|
|
config.trainer.max_num_iterations = 2
|
|
# reduce dataset factors; set dataset to test
|
|
# 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_num_images_to_sample_from = 1
|
|
config.pipeline.dataloader.train_num_rays_per_batch = 4
|
|
config.pipeline.dataloader.eval_dataset = {
|
|
"_target_": "nerfactory.dataloaders.datasets.Blender",
|
|
"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/"
|
|
# remove viewer
|
|
config.viewer.enable = False
|
|
|
|
# model specific config settings
|
|
if config.method_name == "instant_ngp":
|
|
config.pipeline.model.field_implementation = "torch"
|
|
|
|
return config
|
|
|
|
|
|
@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:
|
|
continue
|
|
initialize(version_base="1.2", config_path="../configs/") # relative to test path
|
|
config = compose(config_path)
|
|
config = set_reduced_config(config)
|
|
main(config)
|
|
|
|
GlobalHydra.instance().clear()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_run_train()
|