Hello,
I managed to implement a solution that is different to yours, but I will see if yours works too. Could you check if there are any obvious errors in my solution?
torch.manual_seed(42)

model_NA1 = LSTM(1, 10, 10, 1)
model_NA2 = LSTM(1, 10, 10, 1)

model_NA1.to(device)
model_NA2.to(device)

learning_rate = 0.0001

optimizer1 = torch.optim.Adam(model_NA1.parameters(), lr = learning_rate)
optimizer2 = torch.optim.Adam(model_NA2.parameters(), lr = learning_rate)

no_epochs = 1000

losses1 = np.zeros(no_epochs)
losses2 = np.zeros(no_epochs)

test_losses1 = np.zeros(no_epochs)
test_losses2 = np.zeros(no_epochs)

for i in range(no_epochs):

    optimizer1.zero_grad()
    optimizer2.zero_grad()

    # Forward pass
    output1 = model_NA1(x_train_model)

    loss1 = loss_function(output1, y_train_model)

    loss1.backward()
    optimizer1.step()

    losses1[i] = loss1.item()

    torch.save(model_NA1.state_dict(), 'W_hh.pt')
    state_dict = torch.load('W_hh.pt')

    with torch.no_grad():
        model_NA2.rnn.weight_hh_l0.copy_(state_dict['rnn.weight_hh_l0'])
        model_NA2.rnn.weight_hh_l1.copy_(state_dict['rnn.weight_hh_l1'])
        model_NA2.rnn.weight_hh_l2.copy_(state_dict['rnn.weight_hh_l2'])
        model_NA2.rnn.weight_hh_l3.copy_(state_dict['rnn.weight_hh_l3'])
        model_NA2.rnn.weight_hh_l4.copy_(state_dict['rnn.weight_hh_l4'])
        model_NA2.rnn.weight_hh_l5.copy_(state_dict['rnn.weight_hh_l5'])
        model_NA2.rnn.weight_hh_l6.copy_(state_dict['rnn.weight_hh_l6'])
        model_NA2.rnn.weight_hh_l7.copy_(state_dict['rnn.weight_hh_l7'])
        model_NA2.rnn.weight_hh_l8.copy_(state_dict['rnn.weight_hh_l8'])
        model_NA2.rnn.weight_hh_l9.copy_(state_dict['rnn.weight_hh_l9'])

    #model_NA2.load_state_dict('W_hh.pt', strict = False)

    output2 = model_NA2(x_train_model) 

    loss2 = loss_function(output2, y_train_obs)

    loss2.backward()
    optimizer2.step()

    losses2[i] = loss2.item()

    with torch.no_grad():
        test_outputs1 = model_NA1(x_val_model)
        test_outputs2 = model_NA2(x_val_model)
        test_loss1 = loss_function(test_outputs1, y_val_model)
        test_loss2 = loss_function(test_outputs2, y_val_obs)
        
        test_losses1[i] = test_loss1.item()
        test_losses2[i] = test_loss2.item()


    if (i + 1) %100 == 0:
      print(f'Epoch {i+1}/{no_epochs}, NA1 Loss: {loss1.item():.4f}, NA2 Loss: {loss2.item():.4f}')
      #print(f'Epoch {i+1}/{no_epochs}, NA1 Test Loss: {test_loss1.item():.4f}, NA2 Test Loss: {test_loss2.item():.4f}')


I am slightly concered in that when I run this consecutive times, it gives me different out of sample accuracy metrics. Any thoughts why this may be?