From 9ca4f40fe5ebe36de13d55fc7d034e855a8b4b2f Mon Sep 17 00:00:00 2001 From: WJJ1995 Date: Thu, 14 Oct 2021 17:10:30 +0800 Subject: [PATCH] fixed backbone bug (#684) --- x2paddle/project_convertor/pytorch/models/resnet.py | 2 +- x2paddle/project_convertor/pytorch/models/vgg.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x2paddle/project_convertor/pytorch/models/resnet.py b/x2paddle/project_convertor/pytorch/models/resnet.py index 5e86756..b6a5e1a 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 5393174..93ab6c7 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 -- GitLab