Looking at the sample model method:
def sample_model(m, s, l=50): t = num_str(s) m.bs=1 m.eval() m.reset() res,*_ = m(t) print('...', end='') for i in range(l): n=res[-1].topk(2) n = n if n.data==0 else n word = TEXT.vocab.itos[n.data] print(word, end=' ') if word=='<eos>': break res,*_ = m(n.unsqueeze(0)) m.bs=bs
Does the model remember previous words when going through sample model loop as it is generating the words? Does it some how remember the previous state until reset is called? If so where is that state being remembered in?