Compatibility problem of Kaldi with python version

361 views
Skip to first unread message

Dusefu

unread,
Mar 17, 2019, 3:29:20 AM3/17/19
to kaldi-help
Dear Dan,

I am installing Pytorch to used with Kaldi. When I install using anaconda framework the
default python version changed from python 2.7 to python 3.6. Then, When I try to run the Script 
run_cnn_tdnn_1a.sh from mini_librispeech to my own data. It displayed an error syntax errors
related to the python codes. 

learning_rate_factor=$(echo "print 0.5/$xent_regularize" | python)

It can syntax error Missing parentheses it to call 'print'. When I fix it, it also displayed the indentation error in the convolution.py which was ok before.
I think the problem is a compatibility problem. 
How can I make it compatible the Kaldi with python 3.6?

With best regards,

Jan Trmal

unread,
Mar 17, 2019, 9:11:33 AM3/17/19
to kaldi-help
It's not a good idea to have python3 symlinked as python.
if you change the statement to
learning_rate_factor=$(echo "print(0.5/$xent_regularize)" | python)
it should work for you, but it probably won't work for people using python2
what would work for both groups is
learning_rate_factor=$(echo "print 0.5/$xent_regularize" | perl)

I don't think the error in the convolution.py does relate to this.
y.

--
Go to http://kaldi-asr.org/forums.html find out how to join
---
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.
To post to this group, send email to kaldi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kaldi-help/84100996-17df-4ee7-b305-60844d70af35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

tessfu geteye

unread,
Mar 17, 2019, 11:14:04 AM3/17/19
to kaldi...@googlegroups.com
Thank you Jan Trmal.
I tried both the "learning_rate_factor=$(echo "print(0.5/$xent_regularize)" | python)" and "learning_rate_factor=$(echo "print 0.5/$xent_regularize" | perl)" and both of them solved the error.
However, there are errors occur when parsing xconfig 
steps/nnet3/xconfig_to_configs.py --xconfig-file exp/chain/tdnn1g_sp/configs/network.xconfig --config-dir exp/chain/tdnn1g_sp/configs/ ERROR:root:***Exception caught while parsing the following xconfig line: *** input dim=100 name=ivector Traceback (most recent call last): File "steps/nnet3/xconfig_to_configs.py", line 333, in <module> main() File "steps/nnet3/xconfig_to_configs.py", line 323, in main all_layers = xparser.read_xconfig_file(args.xconfig_file, existing_layers) File "steps/libs/nnet3/xconfig/parser.py", line 183, in read_xconfig_file this_layer = xconfig_line_to_object(line, existing_layers) File "steps/libs/nnet3/xconfig/parser.py", line 88, in xconfig_line_to_object if not config_to_layer.has_key(first_token): AttributeError: 'dict' object has no attribute 'has_key'

I run the script run_tdnn.sh
What do you suggest to fix the errors?  
Is it possible to recovering the python from python 3.6 to python 2.7 to solve the errors?

With regards,

You received this message because you are subscribed to a topic in the Google Groups "kaldi-help" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kaldi-help/emDlHOL8fo4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kaldi-help+...@googlegroups.com.

To post to this group, send email to kaldi...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
-------------------------------------------------------------------------------------------------------------------

Tessfu Geteye

Huazhong University of Science and Technology

Department of Computer Science 

Email:   tessf...@gmail.com

Mobile:      15549424335

Wuhan, China

 

Daniel Povey

unread,
Mar 17, 2019, 11:33:17 AM3/17/19
to kaldi-help
The has_key thing is already fixed in the current version of Kaldi.
I will make a PR to fix all the xent_regularize things though, they exist in many scripts.

Reply all
Reply to author
Forward
0 new messages