FFA-Net icon indicating copy to clipboard operation
FFA-Net copied to clipboard

Problem of pre-trained model

Open XBSong opened this issue 2 years ago • 2 comments

Hi, thank you for releasing the code and pre-trained models.

When I test the pre-trained model ('its_train_ffa_3_19.pk') downloaded from the released website, I got "loading state_dict for DataParallel: Unexpected key(s) in state_dict: "module.g1.la.gamma", "module.g1.last.weight", "module.g1.last.bias", "module.g2.la.gamma", "module.g2.last.weight", "module.g2.last.bias", "module.g3.la.gamma", "module.g3.last.weight", "module.g3.last.bias"."

Do you know why?

Thanks a lot!

Regards.

XBSong avatar Aug 04 '21 08:08 XBSong

Oh,I meet the same issue

SkevyHoo avatar Nov 21 '22 02:11 SkevyHoo

use code

    ffa = None
    gps = 3
    blocks = 19
    model_dir = '.../its_train_ffa_3_19.pk'
    ckp=torch.load(model_dir, map_location = 'cuda')
    ffa = FFA.FFA(gps = gps, blocks = blocks)

    ckpt = ckp['model']
    newckpt = {}
    for k,v in ckpt.items():
        k = (".").join(k.split(".")[1:])
        newckpt[k] = v
    ffa.load_state_dict(newckpt)

that's fine.

peace-dove avatar Mar 25 '23 07:03 peace-dove