Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'list' object has no attribute 'add_figure' #19

Open
mayank5ah opened this issue Jul 11, 2022 · 2 comments
Open

AttributeError: 'list' object has no attribute 'add_figure' #19

mayank5ah opened this issue Jul 11, 2022 · 2 comments

Comments

@mayank5ah
Copy link

AttributeError Traceback (most recent call last)
in ()
1 # Testing the loss & accuracy of the model
----> 2 trainer.test(model)

10 frames
/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py in test(self, model, test_dataloaders, ckpt_path, verbose, datamodule)
912
913 if model is not None:
--> 914 results = self.__test_given_model(model, test_dataloaders)
915 else:
916 results = self.__test_using_best_weights(ckpt_path, test_dataloaders)

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py in __test_given_model(self, model, test_dataloaders)
972 # run test
973 # sets up testing so we short circuit to eval
--> 974 results = self.fit(model)
975
976 # teardown

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py in fit(self, model, train_dataloader, val_dataloaders, datamodule)
497
498 # dispath start_training or start_testing or start_predicting
--> 499 self.dispatch()
500
501 # plugin will finalized fitting (e.g. ddp_spawn will load trained model)

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py in dispatch(self)
538 def dispatch(self):
539 if self.testing:
--> 540 self.accelerator.start_testing(self)
541
542 elif self.predicting:

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/accelerators/accelerator.py in start_testing(self, trainer)
74
75 def start_testing(self, trainer):
---> 76 self.training_type_plugin.start_testing(trainer)
77
78 def start_predicting(self, trainer):

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py in start_testing(self, trainer)
116 def start_testing(self, trainer: 'Trainer') -> None:
117 # double dispatch to initiate the test loop
--> 118 self._results = trainer.run_test()
119
120 def start_predicting(self, trainer: 'Trainer') -> None:

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py in run_test(self)
785 # self.reset_test_dataloader(ref_model)
786 with self.profiler.profile("run_test_evaluation"):
--> 787 eval_loop_results, _ = self.run_evaluation()
788
789 if len(eval_loop_results) == 0:

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/trainer.py in run_evaluation(self, max_batches, on_epoch)
740
741 # lightning module method
--> 742 deprecated_eval_results = self.evaluation_loop.evaluation_epoch_end()
743
744 # hook

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/evaluation_loop.py in evaluation_epoch_end(self)
187
188 # call the model epoch end
--> 189 deprecated_results = self.__run_eval_epoch_end(self.num_dataloaders)
190
191 # enable returning anything

/usr/local/lib/python3.7/dist-packages/pytorch_lightning/trainer/evaluation_loop.py in __run_eval_epoch_end(self, num_dataloaders)
219 if is_overridden('test_epoch_end', model=model):
220 model._current_fx_name = 'test_epoch_end'
--> 221 eval_results = model.test_epoch_end(eval_results)
222 user_reduced = True
223

/content/MTMCT-Person-Re-Identification/mtmct_reid/engine.py in test_epoch_end(self, outputs)
199 fig = plot_distributions(self.trainer.datamodule.st_distribution)
200
--> 201 self.logger.experiment.add_figure('Spatial-Temporal Distribution',
202 fig)
203

@mayank5ah
Copy link
Author

I am getting the above error while testing the model

@SurajDonthi
Copy link
Owner

@mayank5ah Can you please specify the version of Pytorch-lightning being used?

The recommended version is specified in the requirements.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants