ethanweber / nerfbusters

Nerfbusters project
MIT License
215 stars 15 forks source link

RuntimeError: NerfbustersTrainer is not attached to a `Trainer`. #23

Closed FCInter closed 7 months ago

FCInter commented 7 months ago

It's me again. Here is another problem.

Traceback (most recent call last):
  File "nerfstudio/scripts/train.py", line 286, in <module>
    entrypoint()
  File "nerfstudio/scripts/train.py", line 275, in entrypoint
    main(
  File "nerfstudio/scripts/train.py", line 258, in main
    launch(
  File "nerfstudio/scripts/train.py", line 193, in launch
    main_func(local_rank=0, world_size=world_size, config=config)
  File "nerfstudio/scripts/train.py", line 102, in train_loop
    trainer.setup()
  File "/home/mypath/projects/nerfstudio/nerfstudio/engine/trainer.py", line 178, in setup
    self.viewer_state = ViewerState(
  File "/home/mypath/projects/nerfstudio/nerfstudio/viewer/viewer.py", line 240, in __init__
    if len(parse_object(pipeline, LegacyViewerElement, "Custom Elements")) > 0:
  File "/home/mypath/projects/nerfstudio/nerfstudio/viewer/utils.py", line 151, in parse_object
    lower_rets = parse_object(v, type_check, new_tree_stub)
  File "/home/mypath/projects/nerfstudio/nerfstudio/viewer/utils.py", line 139, in parse_object
    obj_props = [(k, getattr(obj, k)) for k in dir(obj)]
  File "/home/mypath/projects/nerfstudio/nerfstudio/viewer/utils.py", line 139, in <listcomp>
    obj_props = [(k, getattr(obj, k)) for k in dir(obj)]
  File "/home/mypath/.conda/envs/nerfstudio/lib/python3.8/site-packages/pytorch_lightning/core/module.py", line 179, in trainer
    raise RuntimeError(f"{self.__class__.__qualname__} is not attached to a `Trainer`.")
RuntimeError: NerfbustersTrainer is not attached to a `Trainer`.
HeaIn commented 7 months ago

I solved it by adding a dummy Trainer in the code. Add this in line 47 of nerfbusters/lightning/nerfbusters_trainer.py self._trainer = pl.Trainer()