Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
53cc3430
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
接近 2 年 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
53cc3430
编写于
8月 22, 2022
作者:
G
Guanghua Yu
提交者:
GitHub
8月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update paddle2onnx version (#1372)
上级
5c71cc90
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
4 deletion
+11
-4
paddleslim/auto_compression/compressor.py
paddleslim/auto_compression/compressor.py
+4
-1
paddleslim/common/load_model.py
paddleslim/common/load_model.py
+7
-3
未找到文件。
paddleslim/auto_compression/compressor.py
浏览文件 @
53cc3430
...
...
@@ -846,9 +846,12 @@ class AutoCompression:
assert
os
.
path
.
exists
(
infer_model_path
),
'Not found {}, please check it.'
.
format
(
infer_model_path
)
onnx_save_path
=
os
.
path
.
join
(
self
.
final_dir
,
'ONNX'
)
if
not
os
.
path
.
exists
(
onnx_save_path
):
os
.
makedirs
(
onnx_save_path
)
export_onnx
(
self
.
final_dir
,
model_filename
=
self
.
model_filename
,
params_filename
=
self
.
params_filename
,
save_file_path
=
os
.
path
.
join
(
self
.
final_dir
,
model_name
),
save_file_path
=
os
.
path
.
join
(
onnx_save_path
,
model_name
),
deploy_backend
=
deploy_backend
)
paddleslim/common/load_model.py
浏览文件 @
53cc3430
...
...
@@ -207,10 +207,10 @@ def export_onnx(model_dir,
if
not
params_filename
:
params_filename
=
'model.pdiparams'
try
:
pkg
.
require
(
'paddle2onnx
'
)
os
.
system
(
' python -m pip install -U paddle2onnx==1.0.0rc4
'
)
except
:
from
pip._internal
import
main
main
([
'install'
,
'paddle2onnx==1.0.0rc
3
'
])
main
([
'install'
,
'paddle2onnx==1.0.0rc
4
'
])
import
paddle2onnx
paddle2onnx
.
command
.
c_paddle_to_onnx
(
model_file
=
os
.
path
.
join
(
model_dir
,
model_filename
),
...
...
@@ -218,5 +218,9 @@ def export_onnx(model_dir,
save_file
=
save_file_path
,
opset_version
=
opset_version
,
enable_onnx_checker
=
True
,
deploy_backend
=
deploy_backend
)
deploy_backend
=
deploy_backend
,
scale_file
=
os
.
path
.
join
(
model_dir
,
'calibration_table.txt'
),
calibration_file
=
os
.
path
.
join
(
save_file_path
.
rstrip
(
os
.
path
.
split
(
save_file_path
)[
-
1
]),
'calibration.cache'
))
_logger
.
info
(
'Convert model to ONNX: {}'
.
format
(
save_file_path
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录