Search code examples
tensorflowsequence-to-sequencerecurrent-neural-networkbeam-search

How to use the schedule sampling in beam search decoder in tensorflow.


The basic decoder contains a parameter to add helper method that can be a schedule sampling helper. But the beam search decoding does not contain any helper parameter.

While in the code it looks like there is some sampling used, but it is not clear if schedule sampling is used or not. class BeamSearchDecoder(decoder.Decoder): """BeamSearch sampling decoder."""

It would be nice to know and make my doubt clear. Would appreciate any light on this matter. Thanks in advance.


Solution

  • Scheduled sampling helper is used for training. beam search decoder is used for inference. What you should do is: create the beam search decoder using the same cell you used in basic decoder and only use the beam search decoder when you want to perform inference.