Inference with NMT

Learn to do inference with the trained NMT model.

How inferencing is different from the training model

Inferencing is slightly different from the training process for NMT. Because we don’t have a target sentence at the inference time, we need a way to trigger the decoder at the end of the encoding phase. It’s not difficult because we’ve already done the groundwork for this in the data we have. We simply kick off the decoder by using <s> as the first input to the decoder. Then, we recursively call the decoder using the predicted word as the input for the next time step. We continue this way until the model outputs </s> as the predicted token or reaches a predefined sentence length .

How to work with inference models

To do this, we have to define a new model using the existing weights of the training model. This is because our ...