StyleAvatar icon indicating copy to clipboard operation
StyleAvatar copied to clipboard

Error when using pretrained model to train styleunet

Open Onlybyuse opened this issue 2 years ago • 0 comments

Hello, when training the styleunet of model 3 in-the-wild dataset, i use the pretrained model of model 1 with discriminator (face-superresolution) as you suggested (the training of styleunet can start with the pretrained model 1 with discriminator above). But got the the following error

Error(s) in loading state_dict for StyleUNet: size mismatch for from_rgbs.0.conv.0.weight: copying a param with shape torch.Size([32, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 12, 1, 1]). size mismatch for from_rgbs.0.conv.0.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for from_rgbs.1.conv.0.weight: copying a param with shape torch.Size([256, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 12, 1, 1]). size mismatch for from_rgbs.1.conv.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for cond_convs.0.conv1.0.weight: copying a param with shape torch.Size([32, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for cond_convs.0.conv1.0.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for cond_convs.0.conv2.1.weight: copying a param with shape torch.Size([256, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 128, 3, 3]). size mismatch for cond_convs.0.conv2.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for cond_convs.1.conv1.0.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for cond_convs.1.conv1.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for cond_convs.1.conv2.1.weight: copying a param with shape torch.Size([512, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for comb_convs.0.0.weight: copying a param with shape torch.Size([256, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 1024, 3, 3]). size mismatch for comb_convs.0.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for comb_convs.2.0.weight: copying a param with shape torch.Size([512, 1024, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). File "/data4/y00028864/code_project/StyleAvatar/styleunet/train.py", line 325, in <module> generator.load_state_dict(ckpt["g"], strict=False) RuntimeError: Error(s) in loading state_dict for StyleUNet: size mismatch for from_rgbs.0.conv.0.weight: copying a param with shape torch.Size([32, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 12, 1, 1]). size mismatch for from_rgbs.0.conv.0.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for from_rgbs.1.conv.0.weight: copying a param with shape torch.Size([256, 12, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 12, 1, 1]). size mismatch for from_rgbs.1.conv.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for cond_convs.0.conv1.0.weight: copying a param with shape torch.Size([32, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for cond_convs.0.conv1.0.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for cond_convs.0.conv2.1.weight: copying a param with shape torch.Size([256, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 128, 3, 3]). size mismatch for cond_convs.0.conv2.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for cond_convs.1.conv1.0.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for cond_convs.1.conv1.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for cond_convs.1.conv2.1.weight: copying a param with shape torch.Size([512, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for comb_convs.0.0.weight: copying a param with shape torch.Size([256, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 1024, 3, 3]). size mismatch for comb_convs.0.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for comb_convs.2.0.weight: copying a param with shape torch.Size([512, 1024, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).

The mismatch error. Did I understand your words wrong? THX

Onlybyuse avatar Sep 11 '23 12:09 Onlybyuse