a code snippet is as follows:

          set_requires_grad(netD, True)  # enable backprop for D
          optimizer_D.zero_grad()  # set D's gradients to zero
          # Fake; stop backprop to the generator by detaching fake_B
          fake_AB = torch.cat((real_A, fake_B), 1)
          pred_fake = netD(fake_AB.detach())  
          loss_D_fake = criterionGAN(pred_fake, False) 
          # Real
          real_AB = torch.cat((real_A, real_B), 1)  
          pred_real = netD(real_AB)
          loss_D_real = criterionGAN(pred_real, True)
          # combine loss and calculate gradients
          loss_D = (loss_D_fake + loss_D_real) * 0.5  # 
          loss_D.backward()
          optimizer_D.step()
          # netD_weight.zero_grad()

          """Calculate GAN and L1 loss for the generator"""
          # First, G(A) should fake the discriminator
          set_requires_grad(netD, False)   # D requires no gradients when optimizing G
          optimizer.zero_grad()
          fake_AB = torch.cat((real_A, fake_B), 1)
          pred_fake = netD(fake_AB)  # 
          loss_G_GAN = criterionGAN(pred_fake, True)  * 1e-2
          loss = loss_l1 + loss_G_GAN 
          loss.backward()
          optimizer.step()

the model save and load function are as follow:
def save_ckpt(ckpt_name, models, optimizers, n_iter):
    ckpt_dict = {'n_iter': n_iter}
    for prefix, model in models:
        ckpt_dict[prefix] = get_state_dict_on_cpu(model)

    for prefix, optimizer in optimizers:
        ckpt_dict[prefix] = optimizer.state_dict()
    torch.save(ckpt_dict, ckpt_name)

def load_ckpt(ckpt_name, models, optimizers=None):
    ckpt_dict = torch.load(ckpt_name)
    for prefix, model in models:
        assert isinstance(model, nn.Module)
        model.load_state_dict(ckpt_dict[prefix], strict=False)
    if optimizers is not None:
        for prefix, optimizer in optimizers:
            optimizer.load_state_dict(ckpt_dict[prefix])
    return ckpt_dict['n_iter']

error occurs when i load the pre-trained model:
load_ckpt(args.resumeD, [(‘model’, netD)], [(‘optimizer’, optimizer_D)])