Forward run: best practices
Once the model is trained, what would be the best way to use it to do a forward pass in a large dataset (that must be divided in batches not to fill GPU memory) and obtain the output?
What I normally do is to use the LightningModule as a torch Module. However, that forces me to: write a for, explicitly transfer to the device each batch, make sure to cal .eval(), concatenate the output of each batch... all the things that pytorch-lightning saves me from doing during training. But I guess I am missing an obvious simpler option?
In 1.3 there will be a predict function that does all that for you!
You can already use it by installing 1.3.0rc1.