Error while fitting the Trainer

I am trying to train an Object detection model to my custom dataset and i got stuck up with this error could anyone point out to me what i have missed

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/pytorch_lightning/utilities/parsing.py in __getattr__(self, key)
    181         try:
--> 182             return self[key]
    183         except KeyError as exp:

KeyError: 'training_step_output_for_epoch_end'

The above exception was the direct cause of the following exception:

AttributeError                            Traceback (most recent call last)
<ipython-input-11-dfce8e31ba25> in <module>
     14 # call tune to find the lr
     15 # trainer.tune(classifier,train_dataloader,val_dataloader) # we already did it once = 1e-4
---> 16 trainer.fit(detector,train_dataloader,valid_dataloader)

/opt/conda/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in fit(self, model, train_dataloader, val_dataloaders, datamodule)
    497 
    498         # dispath `start_training` or `start_testing` or `start_predicting`
--> 499         self.dispatch()
    500 
    501         # plugin will finalized fitting (e.g. ddp_spawn will load trained model)

/opt/conda/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in dispatch(self)
    544 
    545         else:
--> 546             self.accelerator.start_training(self)
    547 
    548     def train_or_test_or_predict(self):

/opt/conda/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py in start_training(self, trainer)
     71 
     72     def start_training(self, trainer):
---> 73         self.training_type_plugin.start_training(trainer)
     74 
     75     def start_testing(self, trainer):

/opt/conda/lib/python3.7/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py in start_training(self, trainer)
    112     def start_training(self, trainer: 'Trainer') -> None:
    113         # double dispatch to initiate the training loop
--> 114         self._results = trainer.run_train()
    115 
    116     def start_testing(self, trainer: 'Trainer') -> None:

/opt/conda/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in run_train(self)
    635                 with self.profiler.profile("run_training_epoch"):
    636                     # run train epoch
--> 637                     self.train_loop.run_training_epoch()
    638 
    639                 if self.max_steps and self.max_steps <= self.global_step:

/opt/conda/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py in run_training_epoch(self)
    497 
    498             batch_end_outputs = self.process_train_step_outputs(
--> 499                 batch_output.training_step_output_for_epoch_end,
    500                 self.early_stopping_accumulator,
    501                 self.checkpoint_accumulator,

/opt/conda/lib/python3.7/site-packages/pytorch_lightning/utilities/parsing.py in __getattr__(self, key)
    182             return self[key]
    183         except KeyError as exp:
--> 184             raise AttributeError(f'Missing attribute "{key}"') from exp
    185 
    186     def __setattr__(self, key, val):

AttributeError: Missing attribute "training_step_output_for_epoch_end"

Pytorch code implementation :


detector = FasterRCNN(2)

from pytorch_lightning.callbacks.early_stopping import EarlyStopping
early_stop_callback = EarlyStopping(
   monitor='val_accuracy',
   min_delta=0.00,
   patience=3,
   verbose=False,
   mode='max'
)
​
​
# run learning rate finder, results override hparams.learning_rate
trainer = Trainer( gpus=1, progress_bar_refresh_rate=1, max_epochs=1,deterministic=False)
​
# call tune to find the lr
# trainer.tune(classifier,train_dataloader,val_dataloader) # we already did it once = 1e-4
trainer.fit(detector,train_dataloader,valid_dataloader)