TideDancer / interspeech21_emotion

99 stars 20 forks source link

running bash prediction.sh output/tmp cause TypeError: Wav2Vec2ForCTCnCLS.__init__() got an unexpected keyword argument 'gradient_checkpointing' #15

Closed lxrswdd closed 10 months ago

lxrswdd commented 1 year ago

Hi running the demo codes would lead to the following error. Can you help?

Traceback (most recent call last):
  File "/home/guest/Xiangrui/Speech/interspeech21_emotion/run_emotion.py", line 590, in <module>
    main()
  File "/home/guest/Xiangrui/Speech/interspeech21_emotion/run_emotion.py", line 414, in main
    model = Wav2Vec2ForCTCnCLS.from_pretrained(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/guest/anaconda3/envs/MME/lib/python3.11/site-packages/transformers/modeling_utils.py", line 1415, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Wav2Vec2ForCTCnCLS.__init__() got an unexpected keyword argument 'gradient_checkpointing'
TideDancer commented 1 year ago

Sorry for the delay. I think the API changes. You can remove this line https://github.com/TideDancer/interspeech21_emotion/blob/c36dcc0d2bd9a22602c081a5ab064ab5e9d4f019/run_emotion.py#L417C9-L417C31, to disable gradient_checkpointing.

If you want gradient_checkpointing, use model.gradient_checkpointing_enable() after instantiation.

Hope this helps.