So the minimal example to produce the error:
device = torch.device('cuda')
lstm = nn.DataParallel(nn.LSTM(1, 5, batch_first=False), dim=1).to(device)
batch_size = 30
max_length = 20
lengths=torch.tensor([max_length]*batch_size, device=device) 
inputs = torch.zeros(max_length, batch_size, 1, device=device)
inputs_pack = torch.nn.utils.rnn.pack_padded_sequence(inputs, lengths, batch_first=False)
outputs, hidden = lstm(inputs_pack)

which ends up with an exception:

Dimension out of range (expected to be in range of [-1, 0], but got 1)