Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aritrasen87/0b6a7b56490895eb657b397fe86cf303 to your computer and use it in GitHub Desktop.
Save aritrasen87/0b6a7b56490895eb657b397fe86cf303 to your computer and use it in GitHub Desktop.
rnn-lstm_Jigsaw_Toxic_CommentClassification.ipynb
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andysingal
Copy link

@aritrasen87 Thanks for another great noteook, i am getting error:(I have experience the same before an requires some updates)

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[42], line 2
      1 # start the epochs for training with training and validation dataloaders
----> 2 trainer.fit(model, train_dl, val_dl)

File /usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/trainer.py:532, in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
    530 self.strategy._lightning_module = model
    531 _verify_strategy_supports_compile(model, self.strategy)
--> 532 call._call_and_handle_interrupt(
    533     self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
    534 )

File /usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/call.py:43, in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
     41     if trainer.strategy.launcher is not None:
     42         return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
---> 43     return trainer_fn(*args, **kwargs)
     45 except _TunerExitException:
     46     _call_teardown_hook(trainer)

File /usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/trainer.py:571, in Trainer._fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
    561 self._data_connector.attach_data(
    562     model, train_dataloaders=train_dataloaders, val_dataloaders=val_dataloaders, datamodule=datamodule
    563 )
    565 ckpt_path = self._checkpoint_connector._select_ckpt_path(
    566     self.state.fn,
    567     ckpt_path,
    568     model_provided=True,
    569     model_connected=self.lightning_module is not None,
    570 )
--> 571 self._run(model, ckpt_path=ckpt_path)
    573 assert self.state.stopped
    574 self.training = False

File /usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/trainer.py:928, in Trainer._run(self, model, ckpt_path)
    925 self._callback_connector._attach_model_callbacks()
    926 self._callback_connector._attach_model_logging_functions()
--> 928 _verify_loop_configurations(self)
    930 # hook
    931 log.debug(f"{self.__class__.__name__}: preparing data")

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

File /usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/configuration_validator.py:85, in __verify_train_val_loop_configuration(trainer, model)
     78     raise NotImplementedError(
     79         f"Support for `training_epoch_end` has been removed in v2.0.0. `{type(model).__name__}` implements this"
     80         " method. You can use the `on_train_epoch_end` hook instead. To access outputs, save them in-memory as"
     81         " instance attributes."
     82         " You can find migration examples in https://github.com/Lightning-AI/lightning/pull/16520."
     83     )
     84 if callable(getattr(model, "validation_epoch_end", None)):
---> 85     raise NotImplementedError(
     86         f"Support for `validation_epoch_end` has been removed in v2.0.0. `{type(model).__name__}` implements this"
     87         " method. You can use the `on_validation_epoch_end` hook instead. To access outputs, save them in-memory as"
     88         " instance attributes."
     89         " You can find migration examples in https://github.com/Lightning-AI/lightning/pull/16520."
     90     )

NotImplementedError: Support for `validation_epoch_end` has been removed in v2.0.0. `JigsawModel` 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment