■ Working Draft/◎ 에러코드 일기장
[PyTorch 에러] RuntimeError: Error(s) in loading state_dict for Generator:
dhwiii
2021. 6. 16. 22:31
RuntimeError: Error(s) in loading state_dict for Generator:
...
...
...
Unexpected key(s) in state_dict: "epoch", "arch", "best_psnr", "state_dict", "optimizer".
아래와 같이 선언되어 있던 부분을
model.load_state_dict(torch.load(args.model_path, map_location=torch.device("cpu")))
아래로 바꾸어주었더니 오류가 해결 되었습니다.
saved_checkpoint = torch.load(args.model_path)
model.load_state_dict(saved_checkpoint, strict=False)