Skip to content
Discussion options

You must be logged in to vote

Something like this should work :]

from pytorch_lightning.callbacks import Callback
class MyCallback(Callback):
    def __init__(self, ...):
        ...

    # hook for doing something with your datamodule before training step
    def on_train_batch_start(self, trainer, *args, **kwargs):
        dm = trainer.datamodule # this is a reference to your datamodule during training
        # do something here with your datamodule

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by akihironitta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment