RetroCirce / HTS-Audio-Transformer

The official code repo of "HTS-AT: A Hierarchical Token-Semantic Audio Transformer for Sound Classification and Detection"
https://arxiv.org/abs/2202.00874
MIT License
341 stars 62 forks source link

SEDWrapper sed_model problem #54

Closed Roon311 closed 5 months ago

Roon311 commented 6 months ago

I am trying to replicate the training on the esc-50 dataset; however, I am encountering the following error.

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
[<ipython-input-32-8cfe0496a823>](https://localhost:8080/#) in <cell line: 3>()
      1 # Training the model
      2 # You can set different fold index by setting 'esc_fold' to any number from 0-4 in esc_config.py
----> 3 trainer.fit(model, audioset_data)

5 frames
[/usr/local/lib/python3.10/dist-packages/pytorch_lightning/trainer/configuration_validator.py](https://localhost:8080/#) in __verify_train_val_loop_configuration(trainer, model)
     79     # check legacy hooks are not present
     80     if callable(getattr(model, "training_epoch_end", None)):
---> 81         raise NotImplementedError(
     82             f"Support for `training_epoch_end` has been removed in v2.0.0. `{type(model).__name__}` implements this"
     83             " method. You can use the `on_train_epoch_end` hook instead. To access outputs, save them in-memory as"

NotImplementedError: Support for `training_epoch_end` has been removed in v2.0.0. `SEDWrapper` implements this method. You can use the `on_train_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.
alexanderwerning commented 6 months ago

Your pytorch-lightning version is newer, if you want to adapt the code the epoch_end functions need to be renamed: https://github.com/Lightning-AI/pytorch-lightning/pull/16520 and their parameters have to be removed/ the outputs stored as attributes in the object: https://github.com/Lightning-AI/pytorch-lightning/discussions/17182