'Pytorch lightning resuming from checkpoint with new data

I'm wanting to continue the training process for a model using new data.

I understand that you can continue training a Pytorch Lightning model e.g.

pl.Trainer(max_epochs=10, resume_from_checkpoint='./checkpoints/blahblah.ckpt') for example, if you last checkpoint is saved at epoch 5. But is there a way to continue training by adding different data?



Solution 1:[1]

Yes, when you resume from a checkpoint you can provide the new DataLoader or DataModule during the training and your training will resume from the last epoch with the new data.

trainer = pl.Trainer(max_epochs=10, resume_from_checkpoint='./checkpoints/blahblah.ckpt')

trainer.fit(model, new_train_dataloader)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aniket Maurya