Update `overfit_batches` docs (#19622)

This commit is contained in:
awaelchli 2024-03-13 22:47:55 +01:00 committed by GitHub
parent b3275e05d1
commit 97a95ed6cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -20,6 +20,7 @@ Machine learning code requires debugging mathematical correctness, which is not
************************************** **************************************
Overfit your model on a Subset of Data Overfit your model on a Subset of Data
************************************** **************************************
A good debugging technique is to take a tiny portion of your data (say 2 samples per class), A good debugging technique is to take a tiny portion of your data (say 2 samples per class),
and try to get your model to overfit. If it can't, it's a sign it won't work with large datasets. and try to get your model to overfit. If it can't, it's a sign it won't work with large datasets.
@ -28,14 +29,17 @@ argument of :class:`~lightning.pytorch.trainer.trainer.Trainer`)
.. testcode:: .. testcode::
# use only 1% of training data (and turn off validation) # use only 1% of training data
trainer = Trainer(overfit_batches=0.01) trainer = Trainer(overfit_batches=0.01)
# similar, but with a fixed 10 batches # similar, but with a fixed 10 batches
trainer = Trainer(overfit_batches=10) trainer = Trainer(overfit_batches=10)
When using this argument, the validation loop will be disabled. We will also replace the sampler # equivalent to
in the training set to turn off shuffle for you. trainer = Trainer(limit_train_batches=10, limit_val_batches=10)
Setting ``overfit_batches`` is the same as setting ``limit_train_batches`` and ``limit_val_batches`` to the same value, but in addition will also turn off shuffling in the training dataloader.
---- ----