Pytorch-lightning: how to run m validation batches after running every n training batches?

Created on 2 Aug 2020  Â·  6Comments  Â·  Source: PyTorchLightning/pytorch-lightning

🚀 Feature

For example, I'm runing a model on a big dataset. After every 10000 training batches, I'd like to run 1000 validation batches to check the avg_traning_loss and avg_val_loss.

I tried val_check_interval but it just run all validation dataset, which is too big and time consuming. How to validate only part of the validation data?

This is similar to #2534 with something different.

Thanks a lot!
Ben

help wanted question

Most helpful comment

Looks like this is sorted out, so I'm closing it. Thank you @ydcjeff 😄

All 6 comments

Hi! thanks for your contribution!, great first issue!

I think Trainer(limit_val_batches=1000, val_check_interval=10000) will do that.

@ydcjeff Working like a charm! Thank you very much! How do you find these magic parameters? :)

Looks like this is sorted out, so I'm closing it. Thank you @ydcjeff 😄

@ydcjeff Thanks again! :)

Was this page helpful?
0 / 5 - 0 ratings