Stability-AI / generative-models

Generative Models by Stability AI
MIT License
23.14k stars 2.56k forks source link

DiffusionEngine miss 'test_step' define #359

Open zhangxingmeng opened 1 month ago

zhangxingmeng commented 1 month ago

I'm trying to train SDXL, and I encountered two issues when running mnist_cond.yaml. One is that first_stage_model.decoder should be changed to first_stage_model.decode. The other is that DiffusionEngine lacks the definition of test_step, resulting in an error. error msg


  File "/cpfs01/projects-HDD/cfff-282dafecea22_HDD/zhangxingmeng/workspace/generative-models/main.py", line 906, in <module>
    trainer.test(model, data)
  File "/home/zhangxingmeng/miniconda3/envs/stable_diffusion/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 706, in test
    return call._call_and_handle_interrupt(
  File "/home/zhangxingmeng/miniconda3/envs/stable_diffusion/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py", line 42, in _call_and_handle_interrupt
    return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
  File "/home/zhangxingmeng/miniconda3/envs/stable_diffusion/lib/python3.10/site-packages/pytorch_lightning/strategies/launchers/subprocess_script.py", line 92, in launch
    return function(*args, **kwargs)
  File "/home/zhangxingmeng/miniconda3/envs/stable_diffusion/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 749, in _test_impl
    results = self._run(model, ckpt_path=ckpt_path)
  File "/home/zhangxingmeng/miniconda3/envs/stable_diffusion/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 883, in _run
    _verify_loop_configurations(self)
  File "/home/zhangxingmeng/miniconda3/envs/stable_diffusion/lib/python3.10/site-packages/pytorch_lightning/trainer/configuration_validator.py", line 44, in _verify_loop_configurations
    __verify_eval_loop_configuration(model, "test")
  File "/home/zhangxingmeng/miniconda3/envs/stable_diffusion/lib/python3.10/site-packages/pytorch_lightning/trainer/configuration_validator.py", line 108, in __verify_eval_loop_configuration
    raise MisconfigurationException(f"No `{step_name}()` method defined to run `Trainer.{trainer_method}`.")
lightning_fabric.utilities.exceptions.MisconfigurationException: No `test_step()` method defined to run `Trainer.test`.```

The environment is installed by requirement/pt.txt
yuchenrao commented 3 weeks ago

Hi~ I have met the same problem, did you fix it?

Thank you very much. Best, Yuchen