jctian98/e2e_lfmmi

version issue

Closed this issue · 2 comments

Could you please tell me the version of your lhotse?
I have problem running the decoding benchmark because librosa need numpy<1.22, while lhotse is complied with numpy==1.22, the error are as follws

2022-02-22 17:47:07,153 (asr_init:162) WARNING: reading model parameters from exp/train_sp_pytorch_8v100_ddp_rnnt_mmi/results_0/model.last91_100.avg.best
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
Traceback (most recent call last):
File "/mypath/work/k2/E2E-ASR-Framework/egs/aishell1/../..//bin/asr_recog.py", line 456, in
main(sys.argv[1:])
File "/mypath/work/k2/E2E-ASR-Framework/egs/aishell1/../..//bin/asr_recog.py", line 433, in main
recog(args)
File "/mypath/work/k2/E2E-ASR-Framework/egs/aishell1/espnet/asr/pytorch_backend/asr.py", line 1063, in recog
model, train_args = load_trained_model(args.model, training=False)
File "/mypath/work/k2/E2E-ASR-Framework/egs/aishell1/espnet/asr/pytorch_backend/asr_init.py", line 172, in load_trained_model
model_class = dynamic_import(model_module)
File "/mypath/work/k2/E2E-ASR-Framework/egs/aishell1/espnet/utils/dynamic_import.py", line 22, in dynamic_import
m = importlib.import_module(module_name)
File "/mypath/install_dir/anaconda3/envs/k2/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 843, in exec_module
File "", line 219, in _call_with_frames_removed
File "/mypath/work/k2/E2E-ASR-Framework/egs/aishell1/espnet/nets/pytorch_backend/e2e_asr_transducer.py", line 52, in
from espnet.snowfall.warpper.warpper_mmi import K2MMI
File "/mypath/work/k2/E2E-ASR-Framework/egs/aishell1/espnet/snowfall/warpper/warpper_mmi.py", line 19, in
from lhotse.utils import nullcontext
File "/mypath/install_dir/anaconda3/envs/k2/lib/python3.8/site-packages/lhotse/init.py", line 4, in
from .cut import CutSet, MonoCut
File "/mypath/install_dir/anaconda3/envs/k2/lib/python3.8/site-packages/lhotse/cut.py", line 33, in
from lhotse.features import (
File "/mypath/install_dir/anaconda3/envs/k2/lib/python3.8/site-packages/lhotse/features/init.py", line 1, in
from .base import (
File "/mypath/install_dir/anaconda3/envs/k2/lib/python3.8/site-packages/lhotse/features/base.py", line 19, in
from lhotse.features.io import FeaturesWriter, get_reader
File "/mypath/install_dir/anaconda3/envs/k2/lib/python3.8/site-packages/lhotse/features/io.py", line 7, in
import lilcom
File "/mypath/install_dir/anaconda3/envs/k2/lib/python3.8/site-packages/lilcom/init.py", line 2, in
from .lilcom_interface import compress, decompress, get_shape
File "/mypath/install_dir/anaconda3/envs/k2/lib/python3.8/site-packages/lilcom/lilcom_interface.py", line 3, in
from . import lilcom_extension

Thank you very much.

hi!

The lhotse is actually not necessary in this project. You may comment code below to avoid this dependency.

from lhotse.utils import nullcontext

grad_context = nullcontext if self.training else torch.no_grad
with grad_context():

Now the K2MMI is only used in training so there is no need to use torch.no_grad() anymore.
You may do similar things in snowfall/warpper/warpper_ctc.py

We will remove the dependency of lhotse in later commits.

I have slove the problem by reinstall licom from the code with lower version of numpy.Thank you very much !