mismatch convs error 해결

kijh30123·2023년 1월 15일
0

styleGAN2를 custom dataset으로 하다 생긴 문제입니다.

RuntimeError: Error(s) in loading state_dict for Generator:
	Missing key(s) in state_dict: "style.3.weight", "style.3.bias", "style.4.weight", "style.4.bias", "style.5.weight", "style.5.bias", "style.6.weight", "style.6.bias", "style.7.weight", "style.7.bias", "style.8.weight", "style.8.bias". 
	size mismatch for convs.6.conv.weight: copying a param with shape torch.Size([1, 256, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([1, 512, 512, 3, 3]).
	size mismatch for convs.6.activate.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).

이 외에도 계속 mismatch에 대한 오류메시지가 뜨게 됩니다.
아무래도 제가 학습시킨 모델이 Generator와 맞지 않아 생기는 문제 같습니다.

해결 방법은 오류가 나는 곳을 잘 확인해보신 다음
그 파일에서 --channel_multiplier 를 매개변수로 받는다면
실행코드에 --channel_multiplier 1 을 추가해주시고
아니라면 파일로 접근하셔서 Generator 등에 channel_multiplier의 기본 설정을 2에서 1로 바꿔주시면 해결할 수 있습니다.

0개의 댓글