Closed victorkwan closed 7 years ago
Thanks for the fix. I also really appreciate the test case. Could you also add some examples (in README.md) with/without the beam search?
Done. I've updated the README accordingly.
I've merged this into the master1.0 branch and it appears to work with the tensorflow release candidate from earlier today. I'm a little hesitant to merge the master1.0 into the master branch yet as there appears to be some work going on with the seq2seq sections of tensorflow in the master tensorflow branch.
Fixes beam search through a number of changes:
num
words. Second, adding the prime text outside of thebeamsearch()
method would mean that the prime text has no impact on the beam search scores. As such, I've separated the different pick options.predict
function to theBeamSearch
class, as well as the initial state and the prime text. Thepredict()
function allows us to perform a single computation on the RNN to figure out next-step probabilities and state. In the context ofbeamsearch()
, we use thepredict()
function to progress each beam. We treat the state variable as more or less opaque, using it only with thepredict()
function.