'dict' object has no attribute 'task' while decoding the language model

246 views
Skip to first unread message

Sougata Mukherjee

unread,
Jun 3, 2022, 2:09:51 AM6/3/22
to fairseq Users
When i'm trying to run the inference of the finetuned model along with transformer based language model which i'v trained i'm getting this error:

INFO:__main__:| decoding with criterion ctc INFO:__main__:| loading model(s) from /data/Sougata/vakyansh-wav2vec2-experimentation/checkpoints/finetuning/checkpoint_best.pt INFO:fairseq.data.audio.raw_audio_dataset:loaded 3012, skipped 0 samples INFO:__main__:| /data/Sougata/vakyansh-wav2vec2-experimentation/data/inference/IITDH_ENG test 3012 examples Traceback (most recent call last): File "../../wav2vec/fairseq/examples/speech_recognition/infer.py", line 427, in <module> cli_main() File "../../wav2vec/fairseq/examples/speech_recognition/infer.py", line 423, in cli_main main(args) File "../../wav2vec/fairseq/examples/speech_recognition/infer.py", line 283, in main generator = build_generator(args) File "../../wav2vec/fairseq/examples/speech_recognition/infer.py", line 276, in build_generator return W2lFairseqLMDecoder(args, task.target_dictionary) File "/data/Sougata/odia_asr/vakyansh-wav2vec2-experimentation/wav2vec/fairseq/examples/speech_recognition/w2l_decoder.py", line 383, in __init__ with open_dict(lm_args.task): AttributeError: 'dict' object has no attribute 'task'

The command I am using is a folows:-
python ../../wav2vec/fairseq/examples/speech_recognition/infer.py ${data_path} --task audio_pretraining --nbest 1 --path \ ${parentdir}/checkpoints/finetuning/checkpoint_best.pt --gen-subset test --results-path ${result_path} --w2l-decoder fairseqlm \ --lm-model ${parentdir}/lm/${lm_name}/checkpoint_best.pt --lm-weight 2 --word-score -1 --sil-weight 0 --criterion ctc --labels ltr --max-tokens 4000000\ --lexicon ${parentdir}/lm/${lm_name}/lexicon.lst --post-process letter --beam ${beam} \ --model-overrides "{'w2v_path':'${pretrained_model_path}'}"

I have prepared the language model following the link befow:-

I have tried what is given in the following link:-
https://github.com/facebookresearch/fairseq/issues/3488

Environment:
  • ubuntu: 20.04
  • PyTorch Version :1.8.0+cu111
  • OS :Linux
  • How fairseq is installed:
    git clone https://github.com/Open-Speech-EkStep/fairseq -b v2-hydra
    cd fairseq
    pip install -e .
  • Python version:3.8.10
  • CUDA/cuDNN version:11.6
  • GPU models and configuration:
    Model: Unknown
    IRQ: 116
    GPU UUID: GPU-9786cde7-94ef-0954-9d33-a411e441499d
    Video BIOS: 90.02.15.00.04
    Bus Type: PCIe
    DMA Size: 47 bits
    DMA Mask: 0x7fffffffffff
    Bus Location: 0000:18:00.0
    Device Minor: 0
    GPU Excluded: No
Can somebody kindly please fix this issue?

Sougata Mukherjee

unread,
Jul 13, 2022, 6:44:28 AM7/13/22
to fairseq Users
A gentle reminder to the fairseq users
Reply all
Reply to author
Forward
0 new messages