-
Notifications
You must be signed in to change notification settings - Fork 74k
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
BeamSearchDecoder incorrectly truncates results when used with dynamic_decode #13536
Comments
@ebrevdo Can you take a look? I see that you wrote the seq2seq library. I wanted to submit a fix but I don't see how to correct this problem without changing some of the library's public inteface. |
Seems ok to update the BeamSearchDecoder.finalize to use final_state.lengths instead of sequence_lengths -- looks like this fixes a couple of other open issues. We could consider having finalize return new updated sequence lengths to decode_dynamic as well. |
Thanks for catching this! Could you send a PR with the fix and a unit test that catches it? |
Will look into submitting a fix. |
Sorry, I've been meaning to make a PR last week but never got to it. |
No problem. We're evaluating your change internally.
…On Sat, Oct 14, 2017, 7:17 PM bdaskalov ***@***.***> wrote:
Sorry, I've been meaning to make a PR last week but never got to it.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#13536 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABtimxRoy93pElky6ZtzF-ctLOu6Khocks5ssWs8gaJpZM4PxBUM>
.
|
The problem is deeper and the solution requires some additional changes. I'll try to submit something in the next couple days. |
Could anyone tell me when this bug was fixed. I couldn't find it in the release notes. Thank you! @ebrevdo |
It was first released in TensorFlow 1.5. |
@guillaumekln Thank you for the info! |
System information (irrelevant for this bug)
Describe the problem
tf.contrib.seq2seq.BeamSearchDecoder incorrectly truncates some of the results because the same index was previously used for a beam member that ended at a earlier step.
The root of the problem is that the while_loop body in dynamic_decode assumes that sequences are independent and will finish only once. In the same time BeamSearchDecoder creates a tree-like structure where a beam index can be reused in a later step for a state that originates from a different parent index. This causes the decoding loop to sometimes record the wrong sequence length for a beam member. Then this wrong sequence length is passed to BeamSearchDecoder.finalize which returns a truncated sequence.
Source code / logs
I use the following code to workaround the problem. This causes the right sequence to be returned but still the length returned by dynamic_decode is wrong.
The text was updated successfully, but these errors were encountered: