fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

load_model_ensemble() got an unexpected keyword argument 'model_state'??

Open abnerLing opened this issue 5 years ago • 7 comments

When trying to evaluate pretrained models I keep getting the below error. The same error occurs for the multi-lingual model and the wav2vec_small_100h.pt model... I didn't finetune the models as I wanted to check the fairseq provided models first. I'm using the same dictionary and using the fairseq transformer LM. Flashlight python bindings are install correctly and I built fairseq from source using pip install --editable ./ from the master directory.

python ../speech_recognition/infer.py ./english_test/text/ --task audio_pretraining --nbest 1 --path ./pretrained/xlsr_53_56k.pt --results-path ./english_test/ --w2l-decoder fairseqlm --lm-model ./pretrained/lm_librispeech_word_transformer.pt --lm-weight 2 --word-score -1 --sil-weight 0 --criterion ctc --labels ltr

2021-01-11 00:47:43 | INFO | main | | decoding with criterion ctc 2021-01-11 00:47:43 | INFO | main | | loading model(s) from ./pretrained/xlsr_53_56k.pt Traceback (most recent call last): File "../speech_recognition/infer.py", line 428, in cli_main() File "../speech_recognition/infer.py", line 424, in cli_main main(args) File "../speech_recognition/infer.py", line 230, in main models, saved_cfg = checkpoint_utils.load_model_ensemble( TypeError: load_model_ensemble() got an unexpected keyword argument 'model_state'

It seems like a problem with loading the model, but I can't figure out what I did wrong?

abnerLing avatar Jan 11 '21 02:01 abnerLing

Hello @abnerLing , did you solve the problem? I have the same issue.

EmreOzkose avatar Jan 22 '21 11:01 EmreOzkose

@EmreOzkose After pulling the latest commit and downloading the new model at least for the multilingual one (https://github.com/pytorch/fairseq/issues/3042#issuecomment-759835759) it ended up working for me.

abnerLing avatar Jan 24 '21 12:01 abnerLing

Having same issue.

File "examples/speech_recognition/infer.py", line 427, in cli_main() File "examples/speech_recognition/infer.py", line 423, in cli_main main(args) File "examples/speech_recognition/infer.py", line 229, in main models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task( TypeError: load_model_ensemble_and_task() got an unexpected keyword argument 'state'

mishra011 avatar Feb 26 '21 09:02 mishra011

Also having the same issue

alexbittar avatar Apr 09 '21 08:04 alexbittar

Hi, I have the same issue. Did anyone solve this problem?

AbirMessaoudi avatar Apr 13 '21 15:04 AbirMessaoudi

same here. any resolutions?

avneet-singh-nextiva avatar Feb 01 '22 23:02 avneet-singh-nextiva

cp1 = './vq-wav2vec_kmeans.pt'
cp2 = './vq-wav2vec.pt'
wav2vec, metadata = load_model_ensemble([cp1, cp2])

Use load_model_ensemble([cp1, cp2]) with string paths, not loaded model states.

snoop2head avatar Oct 23 '23 01:10 snoop2head