trainer.fit must be called before trainer.predict else predict fails with Misconfiguration Exception
🐛 Bug
I am trying to use the new predict API of the trainer by loading a checkpoint. But it seems that trainer.fit must be called before trainer.predict else the config validator fails:
GPU available: False, used: False
TPU available: None, using: 0 TPU cores
Traceback (most recent call last):
  File "pytorch-lightning_bug.py", line 49, in <module>
    run_bug()
  File "pytorch-lightning_bug.py", line 45, in run_bug
    trainer.predict(model, train_data)
  File "/venv/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1035, in predict
    results = self.fit(model)
  File "/venv/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 462, in fit
    self.train_loop.setup_fit(model, train_dataloader, val_dataloaders, datamodule)
  File "/venv/lib/python3.9/site-packages/pytorch_lightning/trainer/training_loop.py", line 120, in setup_fit
    self.trainer.config_validator.verify_loop_configurations(model)
  File "/venv/lib/python3.9/site-packages/pytorch_lightning/trainer/configuration_validator.py", line 34, in verify_loop_configurations
    self.__verify_train_loop_configuration(model)
  File "/venv/lib/python3.9/site-packages/pytorch_lightning/trainer/configuration_validator.py", line 46, in __verify_train_loop_configuration
    raise MisconfigurationException(
pytorch_lightning.utilities.exceptions.MisconfigurationException: No `training_step()` method defined. Lightning `Trainer` expects as minimum a `training_step()`, `train_dataloader()` and `configure_optimizers()` to be defined.

To Reproduce
import os

import torch
from torch.utils.data import Dataset

from pytorch_lightning import LightningModule, Trainer


class RandomDataset(Dataset):
    def __init__(self, size, length):
        self.len = length
        self.data = torch.randn(length, size)

    def __getitem__(self, index):
        return self.data[index]

    def __len__(self):
        return self.len


class SimpleModel(LightningModule):
    def __init__(self):
        super().__init__()
        self.layer = torch.nn.Linear(32, 2)

    def forward(self, x):
        return self.layer(x)


def run_bug():
    # fake data
    train_data = torch.utils.data.DataLoader(RandomDataset(32, 64))

    # model
    model = SimpleModel()
    # load the checkpoint …
    trainer = Trainer(
        default_root_dir=os.getcwd(),
        limit_train_batches=1,
        limit_val_batches=1,
        max_epochs=1,
        weights_summary=None,
    )
    # use the train data for prediction
    trainer.predict(model, train_data)


if __name__ == '__main__':
    run_bug()
Expected behavior
Get the predictions of the data source.
Environment

PyTorch Version (e.g., 1.0): 1.2.2
OS (e.g., Linux): macOS, Linux
How you installed PyTorch (conda, pip, source): pip
Build command you used (if compiling from source):
Python version: 3.9.1