Closed Telephone1024 closed 2 years ago
Hi! thanks for your contribution!, great first issue!
Hi @Telephone1024, As stated under the common pitfalls section here: https://torchmetrics.readthedocs.io/en/stable/pages/lightning.html#common-pitfalls we recommend initializing a metric per dataloader when working with multiple datasets to make sure that states are not being mixed (as you are seeing).
Hi @Telephone1024, As stated under the common pitfalls section here: https://torchmetrics.readthedocs.io/en/stable/pages/lightning.html#common-pitfalls we recommend initializing a metric per dataloader when working with multiple datasets to make sure that states are not being mixed (as you are seeing).
thanks for your answer!
🐛 Bug
I just noticed that when I tested my model with multiple dataloaders (which represent different datasets), the results of previous dataloaders will not be reset automaically. Thus all the results are wrong except the first one.
only test the second dataloder:
Obviously, for the first dataloader containing more samples, the results of the second dataloaders are affected by the first one.
Code sample
Expected behavior
Whe the test procedure of one dataloder is over, the
reset()
method of torchmetrics will be called automatically. And the results of the next dataloader with different dataloader_idx will not be affected.I'm a freshman to pytorch-lightning, are there any solutions to my problem?
Environment
Additional context
I'll provide more details if necessary.