facebookresearch / fairseq

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
MIT License
30.38k stars 6.4k forks source link

The shell script examples/speech_to_text/data_utils.py import fairseq.data.audio.audio_utils error. #3845

Closed Cuihao1208 closed 2 years ago

Cuihao1208 commented 3 years ago

🐛 Bug

I got the following error when try to run S2T Example: Speech Recognition (ASR) on LibriSpeech. Then error:

Traceback (most recent call last):
  File "examples/speech_to_text/prep_librispeech_data.py", line 14, in <module>
    from examples.speech_to_text.data_utils import (
  File "/fairseq-master/examples/speech_to_text/data_utils.py", line 17, in <module>
    from fairseq.data.audio.audio_utils import (
ImportError: cannot import name '_convert_to_mono' from 'fairseq.data.audio.audio_utils' (/fairseq-master/fairseq/data/audio/audio_utils.py)

To Reproduce

Steps to reproduce the behavior : python examples/speech_to_text/prep_librispeech_data.py --output-root ${LS_ROOT} --vocab-type unigram --vocab-size 10000

Code sample

line 17-19 in examples/speech_to_text/data_utils.py:

from fairseq.data.audio.audio_utils import (
    _convert_to_mono, _get_kaldi_fbank, _get_torchaudio_fbank
)

The func "_convert_to_mono" in fairseq/data/audio/audio_utils.py is deleted on 28 Jul: Add speech/text joint training for speech to text task

Expected behavior

Hope to update related references when updating a script.

Environment

arabae commented 3 years ago

I also inquired about this issue. (https://github.com/pytorch/fairseq/issues/3809) For a simple fix, replace "_convert_to_mono" with "convert_to_mono".

kahne commented 3 years ago

Thanks for reporting the bug! Please pull our latest code for a fix.