threestudio-project / threestudio

A unified framework for 3D content generation.
Apache License 2.0
6.32k stars 480 forks source link

[Stable-zero123] error in guidance evaluation #439

Open sange1104 opened 8 months ago

sange1104 commented 8 months ago

Hi ThreeStudio team,

I tried to run stable-zero123 with freq.guidance_eval = 1 in stable_zero123.yaml file.

python launch.py --config configs/stable-zero123.yaml --train --gpu 0 data.image_path=./load/images/chair_rgba.png --gradio

but I encountered the following error.

Traceback (most recent call last):
  File "/home/sange/3D/threestudio/launch.py", line 300, in <module>
    main(args, extras)
  File "/home/sange/3D/threestudio/launch.py", line 245, in main
    trainer.fit(system, datamodule=dm, ckpt_path=cfg.resume)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 543, in fit
    call._call_and_handle_interrupt(
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/trainer/call.py", line 44, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 579, in _fit_impl
    self._run(model, ckpt_path=ckpt_path)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 986, in _run
    results = self._run_stage()
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1032, in _run_stage
    self.fit_loop.run()
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/fit_loop.py", line 205, in run
    self.advance()
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/fit_loop.py", line 363, in advance
    self.epoch_loop.run(self._data_fetcher)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/training_epoch_loop.py", line 138, in run
    self.advance(data_fetcher)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/training_epoch_loop.py", line 242, in advance
    batch_output = self.automatic_optimization.run(trainer.optimizers[0], batch_idx, kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 191, in run
    self._optimizer_step(batch_idx, closure)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 269, in _optimizer_step
    call._call_lightning_module_hook(
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/trainer/call.py", line 157, in _call_lightning_module_hook
    output = fn(*args, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/core/module.py", line 1303, in optimizer_step
    optimizer.step(closure=optimizer_closure)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/core/optimizer.py", line 152, in step
    step_output = self._strategy.optimizer_step(self._optimizer, closure, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/strategies/strategy.py", line 239, in optimizer_step
    return self.precision_plugin.optimizer_step(optimizer, model=model, closure=closure, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/plugins/precision/precision.py", line 122, in optimizer_step
    return optimizer.step(closure=closure, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/torch/optim/optimizer.py", line 385, in wrapper
    out = func(*args, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/torch/optim/optimizer.py", line 76, in _use_grad
    ret = func(self, *args, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/torch/optim/adam.py", line 146, in step
    loss = closure()
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/plugins/precision/precision.py", line 108, in _wrap_closure
    closure_result = closure()
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 144, in __call__
    self._result = self.closure(*args, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 129, in closure
    step_output = self._step_fn()
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/loops/optimization/automatic.py", line 319, in _training_step
    training_step_output = call._call_strategy_hook(trainer, "training_step", *kwargs.values())
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/trainer/call.py", line 309, in _call_strategy_hook
    output = fn(*args, **kwargs)
  File "/home/sange/miniconda3/envs/gen3d/lib/python3.9/site-packages/pytorch_lightning/strategies/strategy.py", line 391, in training_step
    return self.lightning_module.training_step(*args, **kwargs)
  File "/home/sange/3D/threestudio/threestudio/systems/zero123.py", line 236, in training_step
    out = self.training_substep(batch, batch_idx, guidance="zero123")
  File "/home/sange/3D/threestudio/threestudio/systems/zero123.py", line 217, in training_substep
    out["comp_rgb"].detach()[: guidance_out["eval"]["bs"]],
KeyError: 'eval'

How can I fix this?

Thanks in advance.