You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
当我加载vitae-b-checkpoint-1599-transform-no-average.pth时,出现了如下错误,我使用的数据集时potsdam
Error(s) in loading state_dict for ViTAE_NC_Win_RVSA_V3_WSZ7:
size mismatch for pos_embed: copying a param with shape torch.Size([1, 197, 768]) from checkpoint, the shape in current model is torch.Size([1, 1024, 768]).
` def init_weights(self, pretrained=None):
"""Initialize the weights in backbone.
Args:
pretrained (str, optional): Path to pre-trained weights.
Defaults to None.
"""
pretrained = pretrained or self.pretrained
def _init_weights(m):
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=.02)
if isinstance(m, nn.Linear) and m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.LayerNorm):
nn.init.constant_(m.bias, 0)
nn.init.constant_(m.weight, 1.0)
if isinstance(pretrained, str):
self.apply(_init_weights)
logger = get_root_logger()
print(f"load from {pretrained}")
checkpoint = _load_checkpoint(self.pretrained, logger=logger,map_location='cpu')
if 'state_dict' in checkpoint:
state_dict = checkpoint['state_dict']
elif 'model' in checkpoint:
state_dict = checkpoint['model']
else:
state_dict = checkpoint
self.load_state_dict(state_dict, False)
elif pretrained is None:
self.apply(_init_weights)
else:
raise TypeError('pretrained must be a str or None')`
The text was updated successfully, but these errors were encountered:
当我加载vitae-b-checkpoint-1599-transform-no-average.pth时,出现了如下错误,我使用的数据集时potsdam
Error(s) in loading state_dict for ViTAE_NC_Win_RVSA_V3_WSZ7:
size mismatch for pos_embed: copying a param with shape torch.Size([1, 197, 768]) from checkpoint, the shape in current model is torch.Size([1, 1024, 768]).
` def init_weights(self, pretrained=None):
"""Initialize the weights in backbone.
The text was updated successfully, but these errors were encountered: