Cannot replicate cross-validation metric after loading checkpoint #6081
Unanswered
IamGianluca
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 1 comment 1 reply
-
I can see you have an except ValueError:
metric = 0.50 in your metric code. Could it be that you simply end up in that case after loading from and checkpoint? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm having trouble understanding what is wrong with a multi-label image classifier I've built. The classifier achieves pretty decent performance when using 5-fold cross-validation (0.86 AUC). However, when loading the beck checkpoint from one of the fold, and trying to make predictions on the test set, performance poor (0.50, basically random). Even more shocking, after loading the best checkpoint for one of the folds, predictions on the full training set appear to be random (0.50 AUC).
I'm starting to wonder if I'm doing something wrong when trying to load the checkpoint, as everything else looks alright 😕
Here is how I set up the callbacks and Trainer:
... and finally, here is how I'm loading the checkpoint before making some inference.
Just for reference, this is the output of one fold...
If that can be of any help, I'm using
BCEWithLogitsLoss
as a loss function and roc_auc_score (macro) as a metric.Are you able to spot anything wrong with my code?
EDIT 1: After further investigations, I don't think the issue is with loading the weights.
This is even more confusing, as I'm using the same exact evaluation metrics during training and to evaluate the final predictions. Maybe the error is in how I compute the predictions (?).
EDIT 2: Finally, I've also tried to remove the custom filename pattern I use for the checkpoint, just to ensure the
ModelCheckpoint
is working fine and saving the best checkpoint given my metric. That also doesn't seem to be the issue.Beta Was this translation helpful? Give feedback.
All reactions