Validation sanity check

Hi, I am new to pytorch lightning. Can someone explain what is validation sanity check ?
Thanks in advance!

You do not want run an entire training loop (could take hours) and then realise that there is a problem in your validation loop. This development process is slow and bug-prone, so we run a small validation sanity check to make sure that your code is fine before actually start training the model.


What exactly does it check?

  1. Does it run the eval code for one batch?
  2. How can I turn it off ?
  3. What is num_sanity_val_steps parameter do? In my code it’s -1 but it still does the entire validation sanity check.

It would be a great help if you can also point me to the code/documentation.

Thanks a lot!

1 Like

the integer value defines the number of validation steps you want to run.
Check the docs here.

1 Like

Would you mind updating this link? It’s broken atm.

For anyone else seeing this now, to disable sanity checks, pass num_sanity_val_steps=0 to the Trainer. Per here