Closed mathephysicist closed 2 years ago
@mathephysicist, it's probably because save_to_csv
callback has not been maintained for a while. PadimLightning model had results
attributes previously, but was then replaced. The callback needs to be updated accordingly to support the new design.
Similar to #16
Describe the bug If you modify padim/config.yaml save_to_csv to True you get an error
File "tools/train.py", line 66, in
train()
File "tools/train.py", line 62, in train
trainer.test(model=model, datamodule=datamodule)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 911, in test
return self._call_and_handle_interrupt(self._test_impl, model, dataloaders, ckpt_path, verbose, datamodule)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 685, in _call_and_handle_interrupt
return trainer_fn(*args, *kwargs)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 954, in _test_impl
results = self._run(model, ckpt_path=self.tested_ckpt_path)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1199, in _run
self._dispatch()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1275, in _dispatch
self.training_type_plugin.start_evaluating(self)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 206, in start_evaluating
self._results = trainer.run_stage()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1286, in run_stage
return self._run_evaluate()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1334, in _run_evaluate
eval_loop_results = self._evaluation_loop.run()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/loops/base.py", line 151, in run
output = self.on_run_end()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 134, in on_run_end
self._on_evaluation_epoch_end()
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 241, in _on_evaluation_epoch_end
self.trainer.call_hook(hook_name)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1495, in call_hook
callback_fx(args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/callback_hook.py", line 113, in on_test_epoch_end
callback.on_test_epoch_end(self, self.lightning_module)
File "/anomalib/anomalib/utils/callbacks/save_to_csv.py", line 42, in on_test_epoch_end
results = pl_module.results
File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 947, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'PadimLightning' object has no attribute 'results'
Expected behavior I believe I should get a csv with the F1/AUROC scores?
Additional context I built my environment following the steps provided.