harlanhong / CVPR2022-DaGAN

Official code for CVPR2022 paper: Depth-Aware Generative Adversarial Network for Talking Head Video Generation
https://harlanhong.github.io/publications/dagan.html
Other
958 stars 125 forks source link

Error when load the spade model #4

Closed howardgriffin closed 2 years ago

howardgriffin commented 2 years ago

Nice work! But I have encountered a problem that when I load the SPADE model as I load theDaGAN model, the following problem occurs. Any suggestions?


  File "demo.py", line 191, in <module>
    generator, kp_detector = load_checkpoints(config_path=opt.config, checkpoint_path=opt.checkpoint, cpu=opt.cpu)
  File "demo.py", line 46, in load_checkpoints
    generator.load_state_dict(ckp_generator)
  File "/root/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1051, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DepthAwareGenerator:
   Missing key(s) in state_dict: "up_blocks.0.conv.weight", "up_blocks.0.conv.bias",...... "final.bias". 
   Unexpected key(s) in state_dict: "decoder.compress.weight", "decoder.compress.bias", ..."decoder.G_middle_0.norm_0.mlp_beta.weight" ```
Any suggestions?
harlanhong commented 2 years ago

Hi, @howardgriffin

You should use the SPADEDepthAwareGenerator instead of the DepthAwareGenerator when you load the SPADE model. Thanks.

howardgriffin commented 2 years ago

Got it! Thank you.