Skip to content
Discussion options

You must be logged in to vote

hey @malfonsoarquimea !

Callback.training_step is not a hook so it won't be called automatically. For you use-case you can do something like:

class CustomCallback(Callback):
    def __init__(..., every_n_train_steps):
        self.every_n_train_steps = every_n_train_steps
        ...
    
    def on_train_batch_end(self, trainer, pl_module, *args, **kwargs):
        if trainer.global_step % self.every_n_train_steps == 0:
            outputs = pl_module(self.input)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@malfonsoarquimea
Comment options

Answer selected by malfonsoarquimea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment