The code is running well and fine in CPU. Even though kaggle could not allocate enough memory as my dataset was huge. So I shrinked to a smaller size and it ran smooth even with the command you mentioned. But when I run in GPU with this command with the whole datasets, the exact same error showed up. I am posting the error again.
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-bf1cd602e30e> in <module>
    540         # print("Shape : " , _.shape)
    541 
--> 542         predictions, h = model(inp.permute(1,0).to(device), lens, device  ) # TODO:don't need _   #Changed Permute
    543 
    544         # print(targ)

/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    475             result = self._slow_forward(*input, **kwargs)
    476         else:
--> 477             result = self.forward(*input, **kwargs)
    478         for hook in self._forward_hooks.values():
    479             hook_result = hook(self, input, result)

<ipython-input-3-bf1cd602e30e> in forward(self, x, lens, device)
    449     def forward(self, x, lens, device ):
    450         x = self.embedding(x)
--> 451         self.hidden = self.initialize_hidden_state(device)
    452         h = self.initialize_hidden_state(device)
    453 

<ipython-input-3-bf1cd602e30e> in initialize_hidden_state(self, device)
    439     def initialize_hidden_state(self, device):
    440 #         weight = next(self.parameters()).data
--> 441         return torch.zeros(((self.n_layers, self.batch_sz, self.hidden_units))).to(device)
    442 #         if (device == "cuda:0"):
    443 #             hidden = (weight.new(self.n_layers, batch_sz, self.hidden_units).zero_().cuda(),

RuntimeError: cuda runtime error (59) : device-side assert triggered at /pytorch/aten/src/THC/generic/THCTensorCopy.cpp:21