Hi,
I implemented autoencoder from ‘Lightning in 2 steps’ on Colab. I am getting an error No training_step()
method defined though I have the training_step() defined. What is the issue.
Below is my code for the Lightnig Module:
class LitAutoEncoder(pl.LightningDataModule):
def init(self):
super().init()
self.encoder=nn.Sequential(
nn.Linear(2828,64),
nn.ReLU(),
nn.Linear(64,3)
)
self.decoder=nn.Sequential(
nn.Linear(3,64),
nn.ReLU(),
nn.Linear(64,2828)
)
def forward(self,x):
embedding=self.encoder(x)
return embedding
def training_step(self,batch,batch_idx):
x,y=batch
x=x.view(x.size(0),-1)
z=self.encoder(x)
x_hat=self.decoder(z)
loss.F.mse_loss(x_hat,x)
self.log(‘train_loss’,loss)
def configure_optimizers(self):
optimizer=torch.optim.Adam(self.parameters,lr=1e-3)
return optimizer