Skip to content

NotImplementedError: Support for validation_epoch_end has been removed in v2.0.0. DocFormer implements this method #53

@Arun-purakkatt

Description

@Arun-purakkatt

Ran into this issue while running sample notebook on colab ... https://github.com/shabie/docformer/blob/master/examples/docformer_pl/document_image_classification_on_rvl_cdip/4.Document-image-classification-with-docformer.ipynb


1 if __name__ == "__main__":
----> 2     main()

6 frames
[<ipython-input-25-82eba9431764>](https://localhost:8080/#) in main()
     29         deterministic=True
     30     )
---> 31     trainer.fit(docformer, datamodule)

[/usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/trainer.py](https://localhost:8080/#) in fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
    527         model = _maybe_unwrap_optimized(model)
    528         self.strategy._lightning_module = model
--> 529         call._call_and_handle_interrupt(
    530             self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
    531         )

[/usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/call.py](https://localhost:8080/#) in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
     40         if trainer.strategy.launcher is not None:
     41             return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
---> 42         return trainer_fn(*args, **kwargs)
     43 
     44     except _TunerExitException:

[/usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/trainer.py](https://localhost:8080/#) in _fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
    566             model_connected=self.lightning_module is not None,
    567         )
--> 568         self._run(model, ckpt_path=ckpt_path)
    569 
    570         assert self.state.stopped

[/usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/trainer.py](https://localhost:8080/#) in _run(self, model, ckpt_path)
    919         self._callback_connector._attach_model_logging_functions()
    920 
--> 921         _verify_loop_configurations(self)
    922 
    923         # hook

[/usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/configuration_validator.py](https://localhost:8080/#) in _verify_loop_configurations(trainer)
     34         raise ValueError("Unexpected: Trainer state fn must be set before validating loop configuration.")
     35     if trainer.state.fn == TrainerFn.FITTING:
---> 36         __verify_train_val_loop_configuration(trainer, model)
     37         __verify_manual_optimization_support(trainer, model)
     38         __check_training_step_requires_dataloader_iter(model)

[/usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/configuration_validator.py](https://localhost:8080/#) in __verify_train_val_loop_configuration(trainer, model)
     82         )
     83     if callable(getattr(model, "validation_epoch_end", None)):
---> 84         raise NotImplementedError(
     85             f"Support for `validation_epoch_end` has been removed in v2.0.0. `{type(model).__name__}` implements this"
     86             " method. You can use the `on_validation_epoch_end` hook instead. To access outputs, save them in-memory as"

NotImplementedError: Support for `validation_epoch_end` has been removed in v2.0.0. `DocFormer` implements this method. You can use the `on_validation_epoch_end` hook instead. To access outputs, save them in-memory as instance attributes. You can find migration examples in https://github.com/Lightning-AI/lightning/pull/16520.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions