Error in applying G2P.

179 views
Skip to first unread message

Yash

unread,
Dec 12, 2015, 6:06:51 PM12/12/15
to kaldi-help
Hi,

I have been trying to do KWS for OOV words. I was able to train the confusion matrix and the g2p model. I am however getting an error when I am applying the g2p model. Below is the error message:

# cat stanford_cs/data/kws/g2p/wordlist.txt | g2p.py -V 0.95 --variants-number 10 --encoding utf-8 --model exp/g2p/g2p.model.final --apply - > stanford_cs/data/kws/g2p/output 
# Started at Fri Dec 11 23:33:33 EST 2015
#
Traceback (most recent call last):
  File "/data/ASR1/tools/G2P/g2p/g2p.py", line 38, in <module>
    import SequiturTool
  File "/data/ASR1/tools/G2P/g2p/SequiturTool.py", line 34, in <module>
    from sequitur import Sequitur, ModelTemplate, DefaultDiscountAdjuster, StaticDiscounts, FixedDiscounts, EagerDiscountAdjuster
  File "/data/ASR1/tools/G2P/g2p/sequitur.py", line 32, in <module>
    import sequitur_, SequenceModel, Minimization, misc
  File "/data/ASR1/tools/G2P/g2p/sequitur_.py", line 5, in <module>
    import _sequitur_
ImportError: /data/ASR1/tools/G2P/g2p/build/lib.linux-x86_64-2.4/_sequitur_.so: undefined symbol: Py_InitModule4
# Accounting: time=7 threads=1
# Ended (code 1) at Fri Dec 11 23:33:40 EST 2015, elapsed time 7 seconds

The funny part is, I was able to run this a few months ago. This issue seems like a python version mismatch to me. Can some one help me in figuring out what is wrong with my setup? Please let me know if any more information is required.

Thanks!

Daniel Povey

unread,
Dec 12, 2015, 6:09:41 PM12/12/15
to kaldi-help, Jan Trmal
Sequitur for a long time has not been that easy to install as the original authors have not maintained.  I think recently Yenda (cc'd) modified our setup to use a fork of Sequitur that we control, that we can more easily apply patches and updates too.   I think it's best if you try to install it from scratch, and run any self-tests that it has, before we look into this further though.

Dan

--
You received this message because you are subscribed to the Google Groups "kaldi-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jan Trmal

unread,
Dec 12, 2015, 6:12:38 PM12/12/15
to kaldi-help
Just guessing -- you've updated python during those few months and didn't recompile the sequitur.
Your best shot would be to try to recompile it (you can delete the directory and run the tools/install_sequitur.sh)
y.

Yash

unread,
Dec 12, 2015, 6:16:33 PM12/12/15
to kaldi-help
Ok, let me try doing that. Thanks Yenda.

Yash

unread,
Dec 12, 2015, 10:24:16 PM12/12/15
to kaldi-help
hi Yenda,

I am getting the following error message when I try to install sequitur:

[]$ bash install_sequitur.sh 
python setup.py build
running build
running build_py
copying sequitur_.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_sequitur_' extension
swigging sequitur.i to sequitur_wrap.cpp
swig -python -c++ -shadow -o sequitur_wrap.cpp sequitur.i
gcc -pthread -fno-strict-aliasing -I/data/ASR1/tools/python27/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DMULTIGRAM_SIZE=2 -I/home/iyu/sfep/asr_noisemes/base/lib/python2.7/site-packages/numpy/core/include -I/data/ASR1/tools/python27/include/python2.7 -c sequitur_wrap.cpp -o build/temp.linux-x86_64-2.7/sequitur_wrap.o -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
sequitur_wrap.cpp: In function 'int SWIG_Python_ConvertFunctionPtr(PyObject*, void**, swig_type_info*)':
sequitur_wrap.cpp:2051: error: invalid conversion from 'const char*' to 'char*'
sequitur_wrap.cpp: In function 'void SWIG_Python_FixMethods(PyMethodDef*, swig_const_info*, swig_type_info**, swig_type_info**)':
sequitur_wrap.cpp:6664: error: invalid conversion from 'const char*' to 'char*'
error: command 'gcc' failed with exit status 1
make: *** [build] Error 1
===================================

Any ideas? am I using the incorrect version of gcc?

Yash

unread,
Dec 12, 2015, 11:02:40 PM12/12/15
to kaldi-help
I think this should build against python 2.4 ? 

I assume it had a different kind of type checking... I am not sure though.

Daniel Povey

unread,
Dec 12, 2015, 11:07:19 PM12/12/15
to kaldi-help
Yenda is in our server room at Hopkins where we have had an AC failure, and may not reply till to-morrow.
It could be a swig version issue-- what version is swig?
But I won't know what to do regardless.

Dan

Yash

unread,
Dec 12, 2015, 11:14:35 PM12/12/15
to kaldi-help, dpo...@gmail.com
Hi Dan,

SWIG is:
SWIG Version 1.3.29

Jan Trmal

unread,
Dec 13, 2015, 12:24:25 PM12/13/15
to kaldi-help, Dan Povey
Hi, I think the swig version is quite old -- can you please update it?
I don't think there would be a point in testing out different versions of gcc -- IIRC the python module build process always  calls the gcc the rest of the python was built with. Besides, I tested a bunch of various compilers when fixing the original sequitur and there wasn't any problem.
So I suspect the SWIG -- when I look in the generated C++ wrapper (sequitur_wrap.cpp) on my machine I see 

2420     /* here we get the method pointer for callbacks */
2421     const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2422     const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;

so _if_ there was an incompatibility of the automatically generated SWIG code and recent gcc, it's been already fixed.
Just to be safe -- you have reasonably fresh kaldi, so that you are using the github sequitur repo, right?

y.
Reply all
Reply to author
Forward
0 new messages