Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

changed beam decoder stopping condition #780

Conversation

mirkobronzi
Copy link
Contributor

stopping condition of the beam decoder now works as follows:

-- case return only the first beam (stop_early=True): it will stop when the first beam is 'unbeatable' by the other alive beams. (basically the previous behavior)

-- case return all beams (stop_early=False): it will stop when all the first N beams are 'unbeatable' by the other alive beams.
Note that checking that the last beam (in the top N) is unbeatable implies that all the top N beams are unbeatable as well.

Note w.r.t. the test changes: I duplicated testNotGreedyBeamTwo so that there is now a version with stop_early=True and one with stop_early=False. The first checks only the first beam, the latter will check all the beams.

Other two tests changed as well: they were checking the beam output length (checking it was equal to INPUT_LENGTH + decode_length) - disabled these checks given that this is not true anymore.

…urning all the beams) - also fixed the related tests
…into dev/improve_transformer_decoder_speed

Conflicts:
	tensor2tensor/models/transformer_test.py
@googlebot googlebot added the cla: yes PR author has signed CLA label Jun 14, 2018
@f-lng
Copy link

f-lng commented Jun 28, 2018

Any update on this PR?

@mirkobronzi
Copy link
Contributor Author

@f-lng - It seems to fail the pylint check.
I am not exacly sure why (it doesn't say) - any help appreciated there.

I think the code is working though - all the tests are passing.
(and I am using it since long time now)

Not sure who should take a look in accepting/commenting the MR...
maybe @rsepassi ?
(I think I saw your name in the decoder code comments)

@martinpopel
Copy link
Contributor

Pylint test fails because of https://travis-ci.org/tensorflow/tensor2tensor/jobs/392427948#L1727
463 beam_search._is_finished: Unused argument 'finished_in_finished'
I haven't tried to understand the code, but if the parameter is not needed it should be deleted as _is_finished is an underscore method.

@mirkobronzi
Copy link
Contributor Author

thanks @martinpopel - there are other parameters there that are not used in that method.
(and I think they cannot be removed because they are inside a tf while loop)
But I noticed their names start with unused_ , so, I renamed the finished_in_finished into unused_finished_in_finished, and it seems the pylint check is now passing.

There is now a problem with an autoencoder unit test:
https://travis-ci.org/tensorflow/tensor2tensor/jobs/397916033#L1489

but it seems a problem unrelated to this PR - see last comment here:
#899
(failing on the same test)

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot googlebot added cla: no PR author has not signed CLA and removed cla: yes PR author has signed CLA labels Jul 13, 2018
@mirkobronzi
Copy link
Contributor Author

closing for CLA problems - re-opened here: #965

@mirkobronzi mirkobronzi closed this Aug 1, 2018
@mirkobronzi mirkobronzi deleted the dev/improve_transformer_decoder_speed branch August 6, 2018 09:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: no PR author has not signed CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants