diff --git a/docs/Trainer/Validation loop.md b/docs/Trainer/Validation loop.md index 091cc095..b5670a2d 100644 --- a/docs/Trainer/Validation loop.md +++ b/docs/Trainer/Validation loop.md @@ -5,8 +5,6 @@ Below are all the things lightning automates for you in the validation loop. Lightning will run 5 steps of validation in the beginning of training as a sanity check so you don't have to wait until a full epoch to catch possible validation issues. - - --- #### Check validation every n epochs If you have a small dataset you might want to check validation every n epochs @@ -60,4 +58,6 @@ Lightning runs a few steps of validation in the beginning of training. This avoi ``` {.python} # DEFAULT trainer = Trainer(nb_sanity_val_steps=5) -``` \ No newline at end of file +``` + +You can use `Trainer(nb_sanity_val_steps=0)` to skip the sanity check. diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index 39628ee5..87125b99 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -780,7 +780,7 @@ class Trainer(TrainerIO): # run tiny validation (if validation defined) to make sure program won't crash during val ref_model.on_sanity_check_start() - if self.val_dataloader is not None: + if self.val_dataloader is not None and self.nb_sanity_val_steps > 0: for ds_i, dataloader in enumerate(self.val_dataloader): # reset progress_bar limit for sanity check