Did you try to put the hidden as a parameter of the model ?
class RNN(nn.Module):
    def __init__(self, input_size, hidden_size, output_size, n_layers, batch_size):
        super(RNN, self).__init__()
        self.input_size = input_size
        self.hidden_size = hidden_size
        self.output_size = output_size
        self.n_layers = n_layers 
        
        self.encoder = nn.Embedding(input_size, hidden_size)
        self.GRU = nn.GRU(hidden_size, hidden_size, n_layers) 
        self.decoder = nn.Linear(hidden_size, output_size)
        self.init_hidden(batch_size)
        
    def forward(self, input, batch_size):
        input = self.encoder(input.view(batch_size, seq_len)) 
        input = input.permute(1, 0, 2)
        output, self.hidden = self.GRU(input, self.hidden) 
        output = self.decoder(output.view(batch_size, hidden_size))
        return output
    
    def init_hidden(self, batch_size):
        self.hidden = Variable(torch.randn(self.n_layers, batch_size, self.hidden_size).cuda()