flashlight / text

Text utilities, including beam search decoding, tokenizing, and more, built for use in Flashlight.
MIT License
64 stars 14 forks source link

NameError: name 'CriterionType' is not defined #86

Open mukherjeesougata opened 5 months ago

mukherjeesougata commented 5 months ago

I am trying to decode a fine-tuned ASR model,fine-tuned using the vakyansh toolkit using the this script and the following command line:-

python ../../utils/inference/infer.py ${data_path} --task audio_pretraining \ --nbest 1 --path ${checkpoint_path} --gen-subset ${subset} --results-path ${result_path} --w2l-decoder viterbi \ --lm-weight 2 --word-score -1 --sil-weight 0 --criterion ctc --labels ltr --max-tokens 6000000 \ --post-process letter --model-overrides "{'w2v_path':'${pretrained_model_path}'}" But it is showing the following error:-

Traceback (most recent call last): File "../../utils/inference/infer.py", line 428, in cli_main() File "../../utils/inference/infer.py", line 424, in cli_main main(args) File "../../utils/inference/infer.py", line 283, in main generator = build_generator(args) File "../../utils/inference/infer.py", line 268, in build_generator return W2lViterbiDecoder(args, task.target_dictionary) File "/data/Sougata/vakyansh_latest/vakyansh-wav2vec2-experimentation/wav2vec/fairseq/examples/speech_recognition/w2l_decoder.py", line 115, in init super().init(args, tgt_dict) File "/data/Sougata/vakyansh_latest/vakyansh-wav2vec2-experimentation/wav2vec/fairseq/examples/speech_recognition/w2l_decoder.py", line 56, in init self.criterion_type = CriterionType.CTC NameError: name 'CriterionType' is not defined Flashlight-text was installed using these set of commands and Flashlight-sequence using these set of commands. I have also tried installing flashlight-text and flashlight-sequence using the command python -m pip install flashlight-text, but still it is giving the same error. I have run from flashlight.lib.text.decoder import CriterionType, it is working.

Lalaramarya commented 5 months ago

@tlikhomanenko, I am also facing the same problem. Can you please suggest a solution to this?