The end-of-sequence (</s>) token indicates the end of a generation. When a token sequence containing </s> is decoded, an extra (incorrect) space is inserted at the beginning of the text. To avoid this, strip the eos token out of the result before returning it. The eos token was getting stripped later, so this doesn't change the output except to avoid the spurious leading space.
The end-of-sequence (
</s>
) token indicates the end of a generation. When a token sequence containing</s>
is decoded, an extra (incorrect) space is inserted at the beginning of the text. To avoid this, strip the eos token out of the result before returning it. The eos token was getting stripped later, so this doesn't change the output except to avoid the spurious leading space.