Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bugs? #79

Open
crazylyf opened this issue Jan 16, 2016 · 3 comments
Open

Possible bugs? #79

crazylyf opened this issue Jan 16, 2016 · 3 comments

Comments

@crazylyf
Copy link

Hello,
When I running ocropus-ltrain, it will occasionally warning: "FloatingPointError: overflow encountered in exp", and the program seems to restart from the nearest saved state. The problem occurs mainly in the "ffunc" function in lstm.py, which defines the softmax function using: 1.0/(1.0+exp(-x)). Same problem also occurs in the "sigmoid" function. I think this may be caused by large values in x. In the CLSTM source code, the values x is clipped to 20 for positive values, and -20 for negtive values. After clipping like this, the program goes well without warning.

Another problem is that the "backward" method in class "Parallel" returns None. This is correct for 1-layer BLSTM system, but for multiple layers BLSTM configuration which stacking paralleled BLSTM one over another, this will lead to error, as the deltas of subsequent layer is assigned as the current deltas. So, maybe the method should return deltas.

Best,

@tmbdev
Copy link
Collaborator

tmbdev commented Jan 28, 2016

I'll keep the bug open, but for LSTM training, at this point, you're probably better off using the CLSTM implementation. It is almost a drop-in replacement and considerably faster.

If you want to submit patches for a "safe" sigmoid and for the BLSTM, please do.

zuphilip added a commit that referenced this issue Apr 18, 2017
This should avoid (hopefully) some possible FloatingPointError overflow errors.

The sigmoid function ffunc is for any x<-20 and x>20 already 0 resp. 1 up to 10^-9
and cutting will therefore not change the function substantially.

This idea is from @tmbdev in #5 (comment)
Implemented first in #49 (comment)
Additional infos from #79 (comment)
@zuphilip
Copy link
Collaborator

Fixed in #201.

@zuphilip
Copy link
Collaborator

Second part may still be open:

Another problem is that the "backward" method in class "Parallel" returns None. This is correct for 1-layer BLSTM system, but for multiple layers BLSTM configuration which stacking paralleled BLSTM one over another, this will lead to error, as the deltas of subsequent layer is assigned as the current deltas. So, maybe the method should return deltas.

@zuphilip zuphilip reopened this Dec 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants