gooofy / py-kaldi-asr

Some simple wrappers around kaldi-asr intended to make using kaldi's (online) decoders as convenient as possible.
Apache License 2.0
170 stars 56 forks source link

Some build errors in centos7 #47

Open ben-8878 opened 3 years ago

ben-8878 commented 3 years ago

I need to install ATLAS?

svenha commented 3 years ago

Yes, see https://github.com/gooofy/py-kaldi-asr#atlas

ben-8878 commented 3 years ago

@svenha I install atlas but met follows errors:

python setup.py build_ext --inplace
looking for atlas library, trying pkg-config first...
Package blas-atlas was not found in the pkg-config search path.
Perhaps you should add the directory containing `blas-atlas.pc'
to the PKG_CONFIG_PATH environment variable
No package 'blas-atlas' found
looking for atlas library, pkg-config found it
Traceback (most recent call last):
  File "setup.py", line 113, in <module>
    Extension("kaldiasr.nnet3",
TypeError: __init__() keywords must be strings
make: *** [kaldiasr/nnet3.so] Error 1
svenha commented 3 years ago

Maybe your Linux distribution has a usable version of atlas including a .pc file. E.g. Ubuntu has it in package libatlas-base-dev.

If you must rely on your own atlas installation, you must create a blas-atlas.pc file or similar, which is referenced from kaldi-asr.pc (https://github.com/gooofy/py-kaldi-asr#source) BTW: I had to change the Requires line as follows because of Ubuntu's file structure:

Requires: blas-atlas
svenha commented 3 years ago

OK, so I misunderstood the problem you reported and you should investigate the python error message. Your python must by python2.

ben-8878 commented 3 years ago

OK, so I misunderstood the problem you reported and you should investigate the python error message. Your python must by python2.

i go to python2 env, and get some errors as follows:

python setup.py build_ext --inplace
looking for atlas library, trying pkg-config first...
Package blas-atlas was not found in the pkg-config search path.
Perhaps you should add the directory containing `blas-atlas.pc'
to the PKG_CONFIG_PATH environment variable
No package 'blas-atlas' found
looking for atlas library, pkg-config found it
Traceback (most recent call last):
  File "setup.py", line 122, in <module>
    **find_dependencies()),
TypeError: __init__() keywords must be strings
make: *** [kaldiasr/nnet3.so] Error 1

how to set the blas-atlas.pc ? do you have sample?

ben-8878 commented 3 years ago

my atlas.pc:

prefix=/usr
libdir=${prefix}/lib
includedir=${prefix}/include/atlas

Name: atlas
Description: atlas tool
Version: 3.10
Libs: -Wl,-rpath,/usr/lib -L${libdir} -latlas
Cflags: -I${includedir}  -DHAVE_IMMEDIATE_STRUCTURES=1

maybe it have some relation with linux type? No matter i use python3 or python2 , it always raise errors:TypeError: __init__() keywords must be strings

svenha commented 3 years ago

Maybe your kaldi-asr.pc is broken?

ben-8878 commented 3 years ago

but i met another error: Loading model from model_dir/ ... INTEL MKL ERROR: /home/ybZhang/miniconda2/lib/libmkl_vml_avx512.so.1: cannot open shared object file: No such file or directory. Intel MKL FATAL ERROR: cannot load libmkl_vml_avx512.so.1 or libmkl_vml_def.so.1

ben-8878 commented 3 years ago

Maybe your kaldi-asr.pc is broken?

I remove the find_dependencies() in Extension, maybe it has same problem in centos:

compile_args = ['-Wall', '-pthread', '-std=c++11','-DKALDI_DOUBLEPRECISION=0','-Wno-sign-compare','-Wno-unused-local-typedefs', '-Winit-self','-DHAVE_EXECINFO_H=1', '-DHAVE_CXXABI_H','-DHAVE_ATLAS', '-g']
linker_args = ["-L{}/tools/openfst/lib".format(KALDI_ROOT),
                                   "-L{}/src/lib".format(KALDI_ROOT),
                                   "-lfst", "/usr/lib/libatlas.so.3", "-lm",
                                   "-lpthread", "-ldl", "-lkaldi-decoder", "-lkaldi-lat",
                                   "-lkaldi-fstext", "-lkaldi-hmm", "-lkaldi-feat",
                                                                     "-lkaldi-transform", "-lkaldi-gmm", "-lkaldi-tree",
                                   "-lkaldi-util", "-lkaldi-matrix", "-lkaldi-base", "-lkaldi-nnet3",
                                   "-lkaldi-online2"]
ext_modules += [
    Extension("kaldiasr.nnet3",
              sources=["kaldiasr/nnet3.pyx", "kaldiasr/nnet3_wrappers.cpp"],
              language="c++",
              extra_compile_args=compile_args,                              extra_link_args = linker_args)]
ben-8878 commented 3 years ago

@svenha rescore is not suppoted? rescore has better performance.