def _predict_next_word_sample(self, sentence_list: list):
    test_item = torch.tensor([[self._word_vocab.stoi[x]] for x in sentence_list], device=DEVICE)
    pred_index = torch.multinomial(torch.softmax(self._model(test_item)[(- 1)], dim=0).cpu().data, 1)
    pred_word = self._word_vocab.itos[pred_index]
    return pred_word
def _predict_next_word_sample(self, sentence_list: list):
    test_item = torch.tensor([[self._word_vocab.stoi[x]] for x in sentence_list], device=DEVICE)
    pred_index = torch.multinomial(torch.softmax(self._model(test_item)[(- 1)], dim=0).cpu().data, 1)
    pred_word = self._word_vocab.itos[pred_index]
    return pred_word