lisa-groundhog / GroundHog

Library for implementing RNNs with Theano
BSD 3-Clause "New" or "Revised" License
598 stars 229 forks source link

Beam search k-steps limiting output. #31

Closed KHN190 closed 9 years ago

KHN190 commented 9 years ago

I have a trained model and tested on 1000 lines en-fr corpus, the beam search sample just fed me back less than 20 translations. In the line 60 of sample.py: https://github.com/lisa-groundhog/GroundHog/blob/master/experiments/nmt/sample.py#L60

for k in range(3 * len(seq)):

Is there a specific reason we need to use this number of steps? Since I think it's not large enough for my model to generate results end with enc_dec.state['null_sym_target']. And in my understanding the early truncation of beam search process does not make sense? - When do we stop it? Or just because my trained model is bad (so can't get correct output in infinite steps).

rizar commented 9 years ago

The limitation that a translation should be no more than three times longer than the source sentence seems reasonable. It helps to cut to infinite branches of beam search in which it is not going to generate end-of-sentence token at all. If your model does not generate this token in 3 * len(seq) steps, it is a not really well-trained model. then.