diff --git a/x2paddle/project_convertor/pytorch/models/resnet.py b/x2paddle/project_convertor/pytorch/models/resnet.py index 5e8675600efab86f6bab2f9d0b0580da9ef6db6e..b6a5e1a1eb1fbe0be40fd65b31de5ebfa0c3097a 100644 --- a/x2paddle/project_convertor/pytorch/models/resnet.py +++ b/x2paddle/project_convertor/pytorch/models/resnet.py @@ -302,7 +302,7 @@ def _resnet(arch: str, **kwargs: Any) -> ResNet: model = ResNet(block, layers, **kwargs) if pretrained: - state_dict = get_weights_path_from_url(model_urls[arch]) + state_dict = paddle.load(get_weights_path_from_url(model_urls[arch])) model.load_dict(state_dict) return model diff --git a/x2paddle/project_convertor/pytorch/models/vgg.py b/x2paddle/project_convertor/pytorch/models/vgg.py index 5393174c05f34ee9d21e6f2d67b5ea012c1b8435..93ab6c72839276e9e83c608ef2b79bff5a4c204f 100644 --- a/x2paddle/project_convertor/pytorch/models/vgg.py +++ b/x2paddle/project_convertor/pytorch/models/vgg.py @@ -109,7 +109,7 @@ def _vgg(arch: str, cfg: str, batch_norm: bool, pretrained: bool, kwargs['init_weights'] = False model = VGG(make_layers(cfgs[cfg], batch_norm=batch_norm), **kwargs) if pretrained: - state_dict = get_weights_path_from_url(model_urls[arch]) + state_dict = paddle.load(get_weights_path_from_url(model_urls[arch])) model.load_dict(state_dict) return model