Why has Bolts Datamodules not implemented setup?

I was going through the datamodules of lightning_bolts and realized that train/val_dataloader methods are being used to define ‘transforms’ and ‘datasets’ instead of setup hook as shown in the docs.

Is there any known issue blocking this provision or it’s just a matter of preference?

1 Like

I would say this comes down to preference. If you look at something like STL10, since there are many different splits of data (labelled, unlabelled and a mix of both), keeping transforms within *_dataloader() methods is just easier to track.

The real answer here is because bolts was where the DataModule class originally lived, and it didn’t have a setup hook, if I remember correctly.

We added setup when we integrated DataModule with Lightning, and the bolts implementations just continued to work, so we figured “if it ain’t broke, don’t fix it”.

2 Likes

Thanks for the answer @nate