AI4Bharat / IndicWav2Vec

Pretraining, fine-tuning and evaluation scripts for Indic-Wav2Vec2
https://indicnlp.ai4bharat.org/indicwav2vec
MIT License
82 stars 28 forks source link

Single file inferencing issue #16

Closed sysupdate closed 2 years ago

sysupdate commented 2 years ago

While running single file inferencing with the command inside docker:

python sfi.py --audio-file /workspace/w2v_inference/record.wav --ft-model /workspace/w2v_inference/hindi_large.pt --w2l-decoder kenlm --lexicon /workspace/w2v_inference/hindi/lexicon.lst --kenlm-model /workspace/w2v_inference/hindi/lm.binary

I get an error:

Traceback (most recent call last):
  File "sfi.py", line 260, in load_model_and_update
    mdl, cfg, task = fairseq.checkpoint_utils.load_model_ensemble_and_task([mdl_path])
  File "/home/fairseq/fairseq/checkpoint_utils.py", line 432, in load_model_ensemble_and_task
    task = tasks.setup_task(cfg.task)
  File "/home/fairseq/fairseq/tasks/__init__.py", line 39, in setup_task
    cfg = merge_with_parent(dc(), cfg)
  File "/home/fairseq/fairseq/dataclass/utils.py", line 490, in merge_with_parent
    merged_cfg = OmegaConf.merge(dc, cfg)
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/omegaconf.py", line 321, in merge
    target.merge_with(*others[1:])
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/basecontainer.py", line 331, in merge_with
    self._format_and_raise(key=None, value=None, cause=e)
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/base.py", line 95, in _format_and_raise
    format_and_raise(
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/_utils.py", line 629, in format_and_raise
    _raise(ex, cause)
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/_utils.py", line 610, in _raise
    raise ex  # set end OC_CAUSE=1 for full backtrace
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/basecontainer.py", line 329, in merge_with
    self._merge_with(*others)
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/basecontainer.py", line 347, in _merge_with
    BaseContainer._map_merge(self, other)
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/basecontainer.py", line 314, in _map_merge
    dest[key] = src._get_node(key)
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/dictconfig.py", line 258, in __setitem__
    self._format_and_raise(
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/base.py", line 95, in _format_and_raise
    format_and_raise(
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/_utils.py", line 629, in format_and_raise
    _raise(ex, cause)
  File "/opt/conda/lib/python3.8/site-packages/omegaconf/_utils.py", line 610, in _raise
    raise ex  # set end OC_CAUSE=1 for full backtrace
omegaconf.errors.ConfigKeyError: Key 'sampling_alpha' not in 'AudioFinetuningConfig'
    full_key: sampling_alpha
    reference_type=Optional[AudioFinetuningConfig]
    object_type=AudioFinetuningConfig

The problem seems to stem from the sfi.py file at load_model_and_update, the main loop never breaks, and the exception keeps on happening.

I'm using the finetuned model

tahirjmakhdoomi commented 2 years ago

Hi The same issue has been fixed here please find the link https://github.com/AI4Bharat/IndicWav2Vec/issues/5