k2-fsa / icefall

https://k2-fsa.github.io/icefall/
Apache License 2.0
930 stars 295 forks source link

AttributeError: Can't get attribute 'RaggedInt' on <module '_k2' #61

Closed cdxie closed 7 months ago

cdxie commented 3 years ago

Hi, I finished the training of TDNN-LSTM-CTC,when I run the step of decoding, I met a error:

2021-09-28 14:56:23,027 INFO [decode.py:349] Decoding started 2021-09-28 14:56:23,048 INFO [decode.py:350] {'exp_dir': PosixPath('tdnn_lstm_ctc/exp'), 'lang_dir': PosixPath('data/lang_phone'), 'lm_dir': PosixPath('data/lm'), 'feature_dim': 80, 'subsampling_factor': 3, 'search_beam': 20, 'output_beam': 5, 'min_active_states': 30, 'max_active_states': 10000, 'use_double_scores': True, 'method': 'whole-lattice-rescoring', 'num_paths': 30, 'epoch': 19, 'avg': 5, 'export': False, 'full_libri': True, 'feature_dir': PosixPath('data/fbank'), 'max_duration': 500.0, 'bucketing_sampler': False, 'num_buckets': 30, 'concatenate_cuts': False, 'duration_factor': 1.0, 'gap': 1.0, 'on_the_fly_feats': False, 'shuffle': True, 'return_cuts': True, 'num_workers': 2} 2021-09-28 14:56:23,854 INFO [lexicon.py:113] Loading pre-compiled data/lang_phone/Linv.pt 2021-09-28 14:56:25,177 INFO [decode.py:359] device: cuda:0 Traceback (most recent call last): File "./tdnn_lstm_ctc/decode.py", line 457, in main() File "/opt/conda/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, kwargs) File "./tdnn_lstm_ctc/decode.py", line 362, in main torch.load(f"{params.lang_dir}/HLG.pt", map_location="cpu") File "/opt/conda/lib/python3.8/site-packages/torch/serialization.py", line 594, in load return _load(opened_zipfile, map_location, pickle_module, pickle_load_args) File "/opt/conda/lib/python3.8/site-packages/torch/serialization.py", line 853, in _load result = unpickler.load() AttributeError: Can't get attribute 'RaggedInt' on <module '_k2' from '/opt/conda/lib/python3.8/site-packages/k2-1.8.dev20210918+cuda11.0.torch1.7.1-py3.8-linux-x86_64.egg/_k2.cpython-38-x86_64-linux-gnu.so'>

PS:

python3 -m k2.version Collecting environment information...

k2 version: 1.8 Build type: Release Git SHA1: 8030001c9a002aa17e090a41de3f1146bdfe1e78 Git date: Fri Sep 17 05:42:56 2021 Cuda used to build k2: 11.0 cuDNN used to build k2: 8.0.4 Python version used to build k2: 3.8 OS used to build k2: CMake version: 3.18.0 GCC version: 7.5.0 CMAKE_CUDA_FLAGS: --expt-extended-lambda -gencode arch=compute_35,code=sm_35 --expt-extended-lambda -gencode arch=compute_50,code=sm_50 --expt-extended-lambda -gencode arch=compute_60,code=sm_60 --expt-extended-lambda -gencode arch=compute_61,code=sm_61 --expt-extended-lambda -gencode arch=compute_70,code=sm_70 --expt-extended-lambda -gencode arch=compute_75,code=sm_75 -D_GLIBCXX_USE_CXX11_ABI=0 --compiler-options -Wall --compiler-options -Wno-unknown-pragmas --compiler-options -Wno-strict-overflow CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-strict-overflow PyTorch version used to build k2: 1.7.1 PyTorch is using Cuda: 11.0 NVTX enabled: True With CUDA: True Disable debug: True Sync kernels : False Disable checks: False

I need some help,thanks

csukuangfj commented 3 years ago

@cdxie Could you regenerate your data/lang_phone and your G? They are generated by an older version of k2 and are cached. Now you are using a newer version of k2 to read a file generated by an older version, so it reports that error.