mike9251/simswap-inference-pytorch

Error trying 512 simswap. loading state_dict

arnold408 opened this issue · 0 comments

[root@www simswap-inference-pytorch]# python app.py --config-name=run_image.yaml
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
Error executing job with overrides: []
Traceback (most recent call last):
File "/root/simswap-inference-pytorch/app.py", line 68, in main
app = Application(config)
File "/root/simswap-inference-pytorch/app.py", line 49, in init
self.model = SimSwap(
File "/root/simswap-inference-pytorch/src/simswap.py", line 81, in init
self.simswap_net = get_model(
File "/root/simswap-inference-pytorch/src/model_loader.py", line 75, in get_model
model.load_state_dict(state_dict)
File "/usr/local/lib64/python3.9/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Generator_Adain_Upsample:
Unexpected key(s) in state_dict: "down4.0.weight", "down4.0.bias", "down4.1.weight", "down4.1.bias", "down4.1.running_mean", "down4.1.running_var", "down4.1.num_batches_tracked", "up4.1.weight", "up4.1.bias", "up4.2.weight", "up4.2.bias", "up4.2.running_mean", "up4.2.running_var", "up4.2.num_batches_tracked".

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.


run_image.yaml

data:
id_image: "/root/1.jpg"
att_image: "/root/2.jpg"
specific_id_image: "none"
att_video: "none"
output_dir: "/root"

pipeline:
face_detector_weights: "${hydra:runtime.cwd}/weights/face_detector_scrfd_10g_bnkps.onnx"
face_id_weights: "${hydra:runtime.cwd}/weights/arcface_net.jit"
parsing_model_weights: "${hydra:runtime.cwd}/weights/79999_iter.pth"
simswap_weights: "${hydra:runtime.cwd}/weights/simswap_512_390000_net_G.pth"
gfpgan_weights: "${hydra:runtime.cwd}/weights/GFPGANv1.4_ema.pth"
blend_module_weights: "${hydra:runtime.cwd}/weights/blend_module.jit"
device: "cpu"
crop_size: 512

checkpoint_type: "none" #"official_224" #
face_alignment_type: "none"
smooth_mask_iter: 7
smooth_mask_kernel_size: 17
smooth_mask_threshold: 0.9
face_detector_threshold: 0.6
specific_latent_match_threshold: 0.05
enhance_output: True

defaults:

  • self
  • override hydra/hydra_logging: disabled
  • override hydra/job_logging: disabled

hydra:
output_subdir: null
run:
dir: .