Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
TonyTonyFun
Paddle
提交
0140d74e
P
Paddle
项目概览
TonyTonyFun
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0140d74e
编写于
10月 14, 2020
作者:
L
LielinJiang
提交者:
GitHub
10月 14, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix load pretrained model in hapi (#27893)
* fix hapi load
上级
ed6ee53e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
12 addition
and
14 deletion
+12
-14
python/paddle/tests/CMakeLists.txt
python/paddle/tests/CMakeLists.txt
+2
-0
python/paddle/tests/test_pretrained_model.py
python/paddle/tests/test_pretrained_model.py
+2
-2
python/paddle/vision/models/mobilenetv1.py
python/paddle/vision/models/mobilenetv1.py
+2
-3
python/paddle/vision/models/mobilenetv2.py
python/paddle/vision/models/mobilenetv2.py
+2
-3
python/paddle/vision/models/resnet.py
python/paddle/vision/models/resnet.py
+2
-3
python/paddle/vision/models/vgg.py
python/paddle/vision/models/vgg.py
+2
-3
未找到文件。
python/paddle/tests/CMakeLists.txt
浏览文件 @
0140d74e
...
...
@@ -39,3 +39,5 @@ foreach(src ${DIST_TEST_OPS})
message
(
STATUS
${
src
}
)
py_dist_test
(
${
src
}
SRCS
${
src
}
.py
)
endforeach
()
set_tests_properties
(
test_pretrained_model PROPERTIES TIMEOUT 600
)
python/paddle/tests/test_pretrained_model.py
浏览文件 @
0140d74e
...
...
@@ -33,7 +33,7 @@ class TestPretrainedModel(unittest.TestCase):
if
not
dygraph
:
paddle
.
enable_static
()
net
=
models
.
__dict__
[
arch
]()
net
=
models
.
__dict__
[
arch
](
pretrained
=
True
)
inputs
=
[
InputSpec
([
None
,
3
,
224
,
224
],
'float32'
,
'image'
)]
model
=
paddle
.
Model
(
network
=
net
,
inputs
=
inputs
)
model
.
prepare
()
...
...
@@ -52,7 +52,7 @@ class TestPretrainedModel(unittest.TestCase):
np
.
testing
.
assert_allclose
(
res
[
'dygraph'
],
res
[
'static'
])
def
test_models
(
self
):
arches
=
[
'mobilenet_v1'
,
'mobilenet_v2'
,
'resnet18'
]
arches
=
[
'mobilenet_v1'
,
'mobilenet_v2'
,
'resnet18'
,
'vgg16'
]
for
arch
in
arches
:
self
.
infer
(
arch
)
...
...
python/paddle/vision/models/mobilenetv1.py
浏览文件 @
0140d74e
...
...
@@ -240,9 +240,8 @@ def _mobilenet(arch, pretrained=False, **kwargs):
arch
)
weight_path
=
get_weights_path_from_url
(
model_urls
[
arch
][
0
],
model_urls
[
arch
][
1
])
assert
weight_path
.
endswith
(
'.pdparams'
),
"suffix of weight must be .pdparams"
param
,
_
=
paddle
.
load
(
weight_path
)
param
=
paddle
.
load
(
weight_path
)
model
.
load_dict
(
param
)
return
model
...
...
python/paddle/vision/models/mobilenetv2.py
浏览文件 @
0140d74e
...
...
@@ -194,9 +194,8 @@ def _mobilenet(arch, pretrained=False, **kwargs):
arch
)
weight_path
=
get_weights_path_from_url
(
model_urls
[
arch
][
0
],
model_urls
[
arch
][
1
])
assert
weight_path
.
endswith
(
'.pdparams'
),
"suffix of weight must be .pdparams"
param
,
_
=
paddle
.
load
(
weight_path
)
param
=
paddle
.
load
(
weight_path
)
model
.
load_dict
(
param
)
return
model
...
...
python/paddle/vision/models/resnet.py
浏览文件 @
0140d74e
...
...
@@ -262,9 +262,8 @@ def _resnet(arch, Block, depth, pretrained, **kwargs):
arch
)
weight_path
=
get_weights_path_from_url
(
model_urls
[
arch
][
0
],
model_urls
[
arch
][
1
])
assert
weight_path
.
endswith
(
'.pdparams'
),
"suffix of weight must be .pdparams"
param
,
_
=
paddle
.
load
(
weight_path
)
param
=
paddle
.
load
(
weight_path
)
model
.
set_dict
(
param
)
return
model
...
...
python/paddle/vision/models/vgg.py
浏览文件 @
0140d74e
...
...
@@ -117,9 +117,8 @@ def _vgg(arch, cfg, batch_norm, pretrained, **kwargs):
arch
)
weight_path
=
get_weights_path_from_url
(
model_urls
[
arch
][
0
],
model_urls
[
arch
][
1
])
assert
weight_path
.
endswith
(
'.pdparams'
),
"suffix of weight must be .pdparams"
param
,
_
=
paddle
.
load
(
weight_path
)
param
=
paddle
.
load
(
weight_path
)
model
.
load_dict
(
param
)
return
model
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录