Zero initialization results in Error

Hidden state initialization used to work till yesterday and now its failing. Any solutions?

Here is the stack trace of the error I am getting.

RuntimeError                              Traceback (most recent call last)
<ipython-input-115-1eb91912d235> in <module>()
      1 model = RNNModel(weight_matrix.size(0),
----> 2                  weight_matrix.size(1), 200, 1, 32)

<ipython-input-113-4c416dcef202> in __init__(self, ntoken, ninp, nhid, nlayers, bsz, dropout, tie_weights)
     11         self.softmax = nn.Softmax(dim = 1)
     12         self.init_weights()
---> 13         self.hidden = self.init_hidden(bsz) # the input is a batched consecutive corpus
     14                                             # therefore, we retain the hidden state across batches
     15 

<ipython-input-113-4c416dcef202> in init_hidden(self, bsz)
     31     def init_hidden(self, bsz):
     32         weight = next(self.parameters()).data
---> 33         return (V(weight.new(self.nlayers, bsz, self.nhid).zero_().cuda()),
     34                 V(weight.new(self.nlayers, bsz, self.nhid).zero_().cuda()))
     35 

/usr/local/lib/python3.6/dist-packages/torch/_utils.py in _cuda(self, device, async)
     67         else:
     68             new_type = getattr(torch.cuda, self.__class__.__name__)
---> 69             return new_type(self.size()).copy_(self, async)
     70 
     71 

RuntimeError: cuda runtime error (59) : device-side assert triggered at /pytorch/torch/lib/THC/generic/THCTensorCopy.c:20

Might be unrelated, but helped in the past:
Have you updated the NVidia drivers recently?
I had similar issues when the driver was in a “bad state”. Could you restart your machine and check it again?

Yeah, restarting the driver helps. Thanks.