senarvi / theanolm

TheanoLM is a recurrent neural network language modeling tool implemented using Theano
Apache License 2.0
81 stars 29 forks source link

maximum recursion depth exceeded error #39

Closed amrmalkhatib closed 6 years ago

amrmalkhatib commented 6 years ago

I got this error for the first time with specific file

File "/home/sh/.local/lib/python3.5/site-packages/theanolm/scoring/slflattice.py", line 143, in init self._move_words_to_links() File "/home/sh/.local/lib/python3.5/site-packages/theanolm/scoring/slflattice.py", line 282, in _move_words_to_links visit_link(link) File "/home/sh/.local/lib/python3.5/site-packages/theanolm/scoring/slflattice.py", line 279, in visit_link visit_link(next_link) File "/home/sh/.local/lib/python3.5/site-packages/theanolm/scoring/slflattice.py", line 279, in visit_link visit_link(next_link) . . . File "/home/sh/.local/lib/python3.5/site-packages/theanolm/scoring/slflattice.py", line 279, in visit_link visit_link(next_link) RecursionError: maximum recursion depth exceeded

senarvi commented 6 years ago

Python stops when a recursion reaches a specific number of levels. The maximum depth can be configured. It was increased because the default limit was too small for Theano with deep networks. Seems like the lattice decoder can also reach this limit. Try further increasing the maximum recursion depth here:

https://github.com/senarvi/theanolm/blob/master/bin/theanolm#L87

amrmalkhatib commented 6 years ago

Thank you

senarvi commented 6 years ago

Can you say what value you found working, or create a pull request?

amrmalkhatib commented 6 years ago

I've increased the value to 3M, but it didn't solve the problem so I skipped the file.

senarvi commented 6 years ago

Increasing it enough would probably make the problem disappear, but maybe it's better to prune the lattices to limit their size. It might also be possible to avoid the recursion in _move_words_to_links().