Skip to content

Why does validation epoch end before train epoch? #14318

Discussion options

You must be logged in to vote

When you run trainer.fit(...), there're two calls to validation_step() followed by a call to validation_epoch_end() before any calls to training_step() by default.

The order of all hooks are documented at: https://pytorch-lightning.readthedocs.io/en/1.7.2/common/lightning_module.html#hooks

# the sanity check runs here <--- mind that here's **SANITY CHECK**

on_train_start()
for epoch in epochs:
    fit_loop()
on_train_end()

You can disable it by specifying Trainer(num_sanity_val_steps=0): https://pytorch-lightning.readthedocs.io/en/1.7.2/common/trainer.html#num-sanity-val-steps

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@march-o
Comment options

@akihironitta
Comment options

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