OpenNMT Forum

Speech To Text Preprocess the data Error

I’ve got the following error when trying to preprocess my data for training speech to text: I used command “!onmt_preprocess -data_type audio -src_dir data/speech/an4_dataset -train_src data/speech/src-train.txt -train_tgt data/speech/tgt-train.txt -valid_src data/speech/src-val.txt -valid_tgt data/speech/tgt-val.txt -shard_size 300 -save_data data/speech/demo”
Error: terminate called after throwing an instance of ‘c10::Error’
what(): 1Explicitly provided namespace (torchaudio) in schema string does not match namespace of enclsing 0 block (torchaudio). Move this definition to the (unique) TORCH_LIBRARY block corresponding to this namespace (and consider deleting the namespace from your schema string.) (Error occurred while processing 0 block at /tmp/pip-req-build-o90jp8s1/torchaudio/csrc/register.cpp:8)
Exception raised from _def at /pytorch/aten/src/ATen/core/library.cpp:111 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x42 (0x7fdfe74c81e2 in /usr/local/lib/python3.6/dist-packages/torch/lib/libc10.so)
frame #1: torch::Library::_def(c10::FunctionSchema&&, c10::OperatorName*) & + 0x1e8 (0x7fe01f02d2a8 in /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch_cpu.so)
frame #2: torch::Library::_def(c10::either<c10::OperatorName, c10::FunctionSchema>&&, torch::CppFunction&&) & + 0x1145 (0x7fe01f0310a5 in /usr/local/lib/python3.6/dist-packages/torch/lib/libtorch_cpu.so)
frame #3: + 0x261a8 (0x7fdfd161a1a8 in /usr/local/lib/python3.6/dist-packages/torchaudio/_torchaudio.so)
frame #4: + 0x1fd29 (0x7fdfd1613d29 in /usr/local/lib/python3.6/dist-packages/torchaudio/_torchaudio.so)
frame #5: + 0x10783 (0x7fe032fbb783 in /lib64/ld-linux-x86-64.so.2)
frame #6: + 0x1524f (0x7fe032fc024f in /lib64/ld-linux-x86-64.so.2)
frame #7: _dl_catch_exception + 0x6f (0x7fe032ab151f in /lib/x86_64-linux-gnu/libc.so.6)
frame #8: + 0x1481a (0x7fe032fbf81a in /lib64/ld-linux-x86-64.so.2)
frame #9: + 0xf96 (0x7fe032527f96 in /lib/x86_64-linux-gnu/libdl.so.2)
frame #10: _dl_catch_exception + 0x6f (0x7fe032ab151f in /lib/x86_64-linux-gnu/libc.so.6)
frame #11: _dl_catch_error + 0x2f (0x7fe032ab15af in /lib/x86_64-linux-gnu/libc.so.6)
frame #12: + 0x1745 (0x7fe032528745 in /lib/x86_64-linux-gnu/libdl.so.2)
frame #13: dlopen + 0x71 (0x7fe032528051 in /lib/x86_64-linux-gnu/libdl.so.2)
frame #14: + 0xfd7a (0x7fe030c05d7a in /usr/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so)
frame #15: /usr/bin/python3() [0x50a47f]
frame #16: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #17: /usr/bin/python3() [0x507f24]
frame #18: _PyFunction_FastCallDict + 0x357 (0x509277 in /usr/bin/python3)
frame #19: /usr/bin/python3() [0x594b01]
frame #20: /usr/bin/python3() [0x54a17f]
frame #21: /usr/bin/python3() [0x5517c1]
frame #22: _PyObject_FastCallKeywords + 0x19c (0x5a9eec in /usr/bin/python3)
frame #23: /usr/bin/python3() [0x50a783]
frame #24: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #25: /usr/bin/python3() [0x509918]
frame #26: /usr/bin/python3() [0x50a64d]
frame #27: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #28: /usr/bin/python3() [0x509918]
frame #29: /usr/bin/python3() [0x50a64d]
frame #30: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #31: /usr/bin/python3() [0x509918]
frame #32: /usr/bin/python3() [0x50a64d]
frame #33: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #34: /usr/bin/python3() [0x509918]
frame #35: /usr/bin/python3() [0x50a64d]
frame #36: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #37: /usr/bin/python3() [0x507f24]
frame #38: /usr/bin/python3() [0x516449]
frame #39: PyCFunction_Call + 0x13e (0x5671ce in /usr/bin/python3)
frame #40: _PyEval_EvalFrameDefault + 0x5591 (0x511341 in /usr/bin/python3)
frame #41: /usr/bin/python3() [0x507f24]
frame #42: /usr/bin/python3() [0x509c50]
frame #43: /usr/bin/python3() [0x50a64d]
frame #44: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #45: /usr/bin/python3() [0x509918]
frame #46: /usr/bin/python3() [0x50a64d]
frame #47: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #48: /usr/bin/python3() [0x509918]
frame #49: /usr/bin/python3() [0x50a64d]
frame #50: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #51: /usr/bin/python3() [0x509918]
frame #52: /usr/bin/python3() [0x50a64d]
frame #53: _PyEval_EvalFrameDefault + 0x444 (0x50c1f4 in /usr/bin/python3)
frame #54: _PyFunction_FastCallDict + 0xf5 (0x509015 in /usr/bin/python3)
frame #55: _PyObject_FastCallDict + 0x4f1 (0x5a4d81 in /usr/bin/python3)
frame #56: _PyObject_CallMethodIdObjArgs + 0xee (0x5a5dbe in /usr/bin/python3)
frame #57: PyImport_ImportModuleLevelObject + 0x1fd (0x4f6f4d in /usr/bin/python3)
frame #58: /usr/bin/python3() [0x514414]
frame #59: PyCFunction_Call + 0x103 (0x567193 in /usr/bin/python3)
frame #60: _PyEval_EvalFrameDefault + 0x5591 (0x511341 in /usr/bin/python3)
frame #61: /usr/bin/python3() [0x507f24]
frame #62: /usr/bin/python3() [0x509c50]
frame #63: /usr/bin/python3() [0x50a64d]

Hi,
There probably is an issue with your torch / torchaudio setup.
Did you install the suggested version of torchaudio from requirements.opt.txt?

Hi,
you must add pip install -r requirements.opt.txt after setup OpenNMT-py.
restart runtime
after setup torchaudio
example:
!git clone https://github.com/OpenNMT/OpenNMT-py.git
!python setup.py install
pip install -r requirements.opt.txt
!wget -O data/speech.tgz http://lstm.seas.harvard.edu/latex/speech.tgz; tar zxf data/speech.tgz -C data/
!sudo apt-get install -y sox libsox-dev libsox-fmt-all; pip install git+https://github.com/pytorch/audio
pip install librosa
pip install numpy
import numpy
import librosa
!onmt_preprocess -data_type audio -src_dir data/speech/an4_dataset -train_src data/speech/src-train.txt -train_tgt data/speech/tgt-train.txt -valid_src data/speech/src-val.txt -valid_tgt data/speech/tgt-val.txt -shard_size 300 -save_data data/speech/demo

I have installed the suggested version of torchaudio from requirements.opt.txt