This is potentially a very easy question. I just started with PyTorch lightning and can't figure out how to receive the output of my model after training.
I am interested in both predictions of y_train and y_test as an array of some sort (PyTorch tensor or NumPy array in a later step) to plot next to the labels using different scripts.
dataset = Dataset(train_tensor)
val_dataset = Dataset(val_tensor)
training_generator = torch.utils.data.DataLoader(dataset, **train_params)
val_generator = torch.utils.data.DataLoader(val_dataset, **val_params)
mynet = Net(feature_len)
trainer = pl.Trainer(gpus=0,max_epochs=max_epochs, logger=logger, progress_bar_refresh_rate=20, callbacks=[early_stop_callback], num_sanity_val_steps=0)
trainer.fit(mynet)
In my lightning module I have the functions:
def __init__(self, random_inputs):
def forward(self, x):
def train_dataloader(self):
def val_dataloader(self):
def training_step(self, batch, batch_nb):
def training_epoch_end(self, outputs):
def validation_step(self, batch, batch_nb):
def validation_epoch_end(self, outputs):
def configure_optimizers(self):
Do I need a specific predict function or is there any already implemented way I don't see?