Okay, I just increased my “smaller data-set” size and run on cpu and got the following error
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-56-7ab077e1fecf> in <module>
     20 # h= tuple([each.data for each in h])
     21 
---> 22 output, _ = model(xs.to(device), lens, device,inputs.idx2word )
     23 print(output.size())
     24 print(model)

/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    530             result = self._slow_forward(*input, **kwargs)
    531         else:
--> 532             result = self.forward(*input, **kwargs)
    533         for hook in self._forward_hooks.values():
    534             hook_result = hook(self, input, result)

<ipython-input-54-8bffe47c2362> in forward(self, x, lens, device, idx2word)
     36 
     37             print("----------------")
---> 38         x = self.embedding(x)
     39         self.hidden = self.initialize_hidden_state(device)
     40         h = self.initialize_hidden_state(device)

/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    530             result = self._slow_forward(*input, **kwargs)
    531         else:
--> 532             result = self.forward(*input, **kwargs)
    533         for hook in self._forward_hooks.values():
    534             hook_result = hook(self, input, result)

/opt/conda/lib/python3.6/site-packages/torch/nn/modules/sparse.py in forward(self, input)
    112         return F.embedding(
    113             input, self.weight, self.padding_idx, self.max_norm,
--> 114             self.norm_type, self.scale_grad_by_freq, self.sparse)
    115 
    116     def extra_repr(self):

/opt/conda/lib/python3.6/site-packages/torch/nn/functional.py in embedding(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse)
   1482         # remove once script supports set_grad_enabled
   1483         _no_grad_embedding_renorm_(weight, input, max_norm, norm_type)
-> 1484     return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
   1485 
   1486 

RuntimeError: index out of range: Tried to access index 9164 out of table with 9163 rows. at /opt/conda/conda-bld/pytorch_1579022119164/work/aten/src/TH/generic/THTensorEvenMoreMath.cpp:418

Even though here it says tried to access index out of table, but I was able to output the whole input tensor into sentences before x = self.embedding(x) (line 38)