Handsome_zhou 发表于 2022-5-8 22:44:05

RuntimeError: Error(s) in loading state_dict for Encoder: Missing key...

RuntimeError: Error(s) in loading state_dict for Encoder:
      Missing key(s) in state_dict: "lstm.weight_ih_l0", "lstm.weight_hh_l0", "lstm.bias_ih_l0", "lstm.bias_hh_l0", "lstm.weight_ih_l0_reverse", "lstm.weight_hh_l0_reverse", "lstm.bias_ih_l0_reverse", "lstm.bias_hh_l0_reverse".

该bug解决方法(实测有效):增加load_state_dict()属性,strict=False
model.load_state_dict(checkpoint['state_dict'], strict=False)
页: [1]
查看完整版本: RuntimeError: Error(s) in loading state_dict for Encoder: Missing key...