Pytorch-lightning: Metric names when using multiple dataloader for validation

Created on 25 Nov 2020  路  3Comments  路  Source: PyTorchLightning/pytorch-lightning

Hi guys,

I am using multiple dataloaders for validation. This works great so far, but I have some questions regarding the logged metrics:

As far as I understand, lightning will automatically assign a metric suffix (/dataloader_idx_X). Is there any way for me to control that behaviour? Wandb assumes groups with that slash, and it means, that it groups by metric name and not validation set. However, there are scenarios where it makes much more sense to group by validation set, as they might look at completely different metrics. On the bottom, there is a screenshot on how it looks without any further wanbd configuration.

Apart from my question, this is more of a feature proposal: Can't we supply a (ordered) dictionary instead of a list via val_dataloader() in DataModules? So that it looks like this:

DataModule:

def val_dataloader(self) -> Union[Dict[str, DataLoader], List[Dataloader], DataLoader]:
   return {
      'scenario1': DataLoader('...'),
      'scenario2': DataLoader('...'),
  }

LightningModule

def validation_step(self, batch, batch_idx: int, loader: Union[str, int]):
   # do something
   self.log('my_metric', x)

Which then logs scenarioX/my_metric in case of the example or dataloader_idx_X/my_metric when a list is provided.

Screenshot_20201125_095000

question

Most helpful comment

Hey @kantholtz,

Thanks for sharing your ideas ! It shouldn't be too hard to add.
Let me see if I have some time for it this week.

Best regards,
T.C

All 3 comments

Hi! thanks for your contribution!, great first issue!

Hey @kantholtz,

Thanks for sharing your ideas ! It shouldn't be too hard to add.
Let me see if I have some time for it this week.

Best regards,
T.C

If not, no stress: I wouldn't mind doing it myself and open up a PR :) But unfortunately I will only have time to do that from mid December on.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

versatran01 picture versatran01  路  3Comments

DavidRuhe picture DavidRuhe  路  3Comments

williamFalcon picture williamFalcon  路  3Comments

jcreinhold picture jcreinhold  路  3Comments

srush picture srush  路  3Comments