vqa-outliers icon indicating copy to clipboard operation
vqa-outliers copied to clipboard

Potential Bug Report

Open Ja1Zhou opened this issue 2 years ago • 1 comments

Potential Bug

Hi, thanks for sharing the code. When I was trying to get the code running, I encountered the following error message:

pytorch_lightning.utilities.exceptions.MisconfigurationException: ModelCheckpoint(monitor='val_acc') not found in the returned metrics: ['train_epoch_loss', 'train_epoch_acc']. 
HINT: Did you call self.log('val_acc', value) in the LightningModule?

I went through the code, and I think this might be related to the following block of code which is present in all the models. https://github.com/siddk/vqa-outliers/blob/9cb877ec6848301aec68dc31a2ebd121c521b33e/src/models/lstm_cnn.py#L268-L290

Specifically, I think the this line of code https://github.com/siddk/vqa-outliers/blob/9cb877ec6848301aec68dc31a2ebd121c521b33e/src/models/lstm_cnn.py#L290 should be changed to

        for k, v in log.items():
            self.log(k, v)

which is consistent with the implementation of training_epoch_end and also fixes the error. Moreover, the returns of validation_epoch_end is not accessed in the source code of pytorch-lightning. I also suppose that validation_epoch_end should be symmetric to training_epoch_end. I wonder if my observation is correct. Looking forwarding to your replies~

Ja1Zhou avatar Aug 02 '22 13:08 Ja1Zhou

Encountered the same bug while running dataset map with BUTD. And your solution fixed it. Thanks @Ja1Zhou!

zhang-yu-wei avatar Aug 03 '22 18:08 zhang-yu-wei