I am training a Conv autoencoder on MNIST images and want to save the reconstructed images after every 10 epochs.
```
class AutoEncoder(pl.LightningModule):
def __init__(self):
pass
def forward(self, x):
pass
def training_step(self, batch, batch_idx):
images = batch
out = self.forward(images)
loss = self.loss(out, images)
if epoch % 10:
save(images)
````
I am looking for something like this where the output images are saved every 10 epoch.
I haven't tried anything since I am unable to find any documentation on current epoch no.
I am using pytorch 1.4 and Lightning version 0.7
Hi! thanks for your contribution!, great first issue!
self.current_epoch would do. (self is a lightning module). Though it starts with 0. You can find the definition of the module here.
Though I'd recommend you to use IDE e.g. pycharm so you can go to the definition of the class quickly.
Thanks @philip30 :)
@philip30 tqdm starts from epoch 1 but actually it is epoch 0?
Most helpful comment
self.current_epochwould do. (self is a lightning module). Though it starts with 0. You can find the definition of the module here.https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/core/lightning.py
Though I'd recommend you to use IDE e.g. pycharm so you can go to the definition of the class quickly.