Of course. I experimented with batch_first, but without success. Right now it’s still set batch_first = True.
class SIMLSTM(nn.Module):

def __init__(self, vocab_size, tagset_size, hidden_dim, lstm_layers, embedding_dim):
    super(SIMLSTM, self).__init__()
    self.embedding = nn.Embedding(vocab_size, embedding_dim)
    self.lstm = nn.LSTM(embedding_dim, hidden_dim, batch_first=True)
    self.fc = nn.Linear(hidden_dim, tagset_size)
    
    self.hidden_dim = hidden_dim
    self.lstm_layers = lstm_layers
    
#         self.init_weights()


def init_weights(self):
    initrange = 0.1
    self.embedding.weight.data.uniform_(-initrange, initrange)
    self.fc.bias.data.fill_(0)
    self.fc.weight.data.uniform_(-initrange, initrange)

def forward(self, s1_in, s2_in, hidden_s1, hidden_s2):
    
    
    emb_s1 = self.embedding(s1_in)
    emb_s2 = self.embedding(s2_in)
    
    # Embeddings shaped like: batch_size x padded seq length (40) x embedding_dimension (300)
    
    out_s1, hidden_s1 = self.lstm(emb_s1, hidden_s1)
    out_s2, hidden_s2 = self.lstm(emb_s2, hidden_s2)
    
    print ("Succes!")

def init_hidden(self, bsz):
    weight = next(self.parameters()).data
    return (Variable(weight.new(self.lstm_layers, bsz, self.hidden_dim).zero_()),
                Variable(weight.new(self.lstm_layers, bsz, self.hidden_dim).zero_()))

model = SIMLSTM(VOCAB_SIZE, TAGSET_SIZE, HIDDEN_DIM, LSTM_LAYERS, EMBEDDING_DIM)
if torch.cuda.is_available():
    model.cuda()

criterion = nn.BCEWithLogitsLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=LEARNING_RATE)


hidden_s1 = model.init_hidden(BATCH_SIZE)
hidden_s2 = model.init_hidden(BATCH_SIZE)

Run:
for i in range(1):
    for s1_in, s2_in, labels in generator(BATCH_SIZE, train_s1, train_s2, training_labels):
    
        if torch.cuda.is_available():
            s1_in = s1_in.cuda()
            s2_in = s2_in.cuda()
    
        output, hidden_s1, hidden_s2 = model(s1_in, s2_in, hidden_s1, hidden_s2)
#         hidden_s1 = repackage_hidden(hidden_s1)
#         hidden_s2 = repackage_hidden(hidden_s2)
#         return total_loss[0] / len(data_source)

Without the .is_cuda() statements the “Success” print gets printed, and I’ve done some epochs already that way.