stylegan2 generator error

kijh30123·2023년 1월 15일
0
Traceback (most recent call last):
  File "generate.py", line 76, in <module>
    g_ema.load_state_dict(checkpoint["g_ema"])
  File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1483, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
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". 
[24]

Error(s) in loading state_dict for Generator 라고 적혀있고 bias랑 weight를 불러올 수 없다는 것 같은데 구글링이 어려워서 고생했습니다.

일전에 layer가 맞지 않아 channel_multiplier 를 1로 바꿨다는걸 기억하고 비슷한 맥락이 아닐까 라는 생각이 들었습니다.

더 찾아보니 Auto 설정으로 StyleGAN2를 학습시키면 args.n_mlp를 기존 8이 아닌 2로 작성해줘야 한다고 했던걸 기억했습니다.

이에 generator.py에 있는 args.n_mlp를 2로 바꾸어 오류를 해결하였습니다.

0개의 댓글