Hy, the error is generated at this line.
model.hidden = (torch.zeros(1,1,model.hidden_size).cuda(),
                       torch.zeros(1,1,model.hidden_size).cuda())

Right then you should modify your LSTM class like this.
class LSTM(nn.Module):
   def init(self, input_size=1, hidden_size=100):
        super(LSTM,self).__init__()
        self.hidden_size = hidden_size
        self.hidden= None

Should do