-
Notifications
You must be signed in to change notification settings - Fork 188
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
nan loss function when b approaches 0 #39
Comments
I solved it in the same way as you did. One issue I found however was that the loss still went to NaNs when training on GPUs (I suspect due to GPU float32 constraints but I'm no expert here). To make it run on the GPU I replaced epsilon with 1e-6 instead:
and it seemed to work.. edit* : When I was looking into this I was observing the loss function output using two different functions. Both did the same operations, one used tensorflow the other one used numpy. I used tf.float32, tf.float64, np.float32 and np.float64 dtype values of alphas and betas and I ended up with nans only with the tf.float32 option. |
Great @FedericoNutmeg and relevant to #51. Currently (on develop+master) it looks like Line 169 in 2661265
Where In the numeric stability tests I might actually be using float64, this should be updated. |
I have tried to solve the problem with nan loss and I found this trick to be helpful: adding the epsilon constant to the argument of np.log:
This way when b ~ 0, thus hazard1 = hazard0, the logarithm is always defined.
wtte-rnn/python/wtte/wtte.py
Line 202 in c0075a7
The text was updated successfully, but these errors were encountered: