without looking at code it’s hard to tell if there’s a silly bug. The most common such error is if you are summing the loss across timesteps, like this:
for epoch in range(epocs):
    for ... in dataset:
        err = criterion(model(input), target)
        loss += err  #### WRONG, it holds onto the entire graph that `err` was computed from
        loss += err.data[0]  #### CORRECT, just gets the loss' scalar value
        print(loss)
        ...