Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
1c9eb445
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1c9eb445
编写于
6月 15, 2022
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
onnx opt and check result
上级
7cd40e40
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
33 addition
and
2 deletion
+33
-2
speechx/examples/ds2_ol/onnx/local/infer_check.py
speechx/examples/ds2_ol/onnx/local/infer_check.py
+7
-1
speechx/examples/ds2_ol/onnx/local/onnx_clone.sh
speechx/examples/ds2_ol/onnx/local/onnx_clone.sh
+0
-0
speechx/examples/ds2_ol/onnx/local/onnx_infer_shape.py
speechx/examples/ds2_ol/onnx/local/onnx_infer_shape.py
+0
-0
speechx/examples/ds2_ol/onnx/local/onnx_opt.sh
speechx/examples/ds2_ol/onnx/local/onnx_opt.sh
+17
-1
speechx/examples/ds2_ol/onnx/local/onnx_prune_model.py
speechx/examples/ds2_ol/onnx/local/onnx_prune_model.py
+0
-0
speechx/examples/ds2_ol/onnx/run.sh
speechx/examples/ds2_ol/onnx/run.sh
+9
-0
未找到文件。
speechx/examples/ds2_ol/onnx/local/infer_check.py
浏览文件 @
1c9eb445
...
...
@@ -34,6 +34,12 @@ def parse_args():
default
=
"."
,
help
=
"paddle model dir."
)
parser
.
add_argument
(
'--model_prefix'
,
type
=
str
,
default
=
"avg_1.jit"
,
help
=
"paddle model prefix."
)
parser
.
add_argument
(
'--onnx_model'
,
type
=
str
,
...
...
@@ -58,7 +64,7 @@ if __name__ == '__main__':
chunk_state_c_box
=
iodict
[
'chunk_state_c_bos'
]
# paddle
model
=
paddle
.
jit
.
load
(
os
.
path
.
join
(
FLAGS
.
model_dir
,
"avg_1.jit"
))
model
=
paddle
.
jit
.
load
(
os
.
path
.
join
(
FLAGS
.
model_dir
,
FLAGS
.
model_prefix
))
res_chunk
,
res_lens
,
chunk_state_h
,
chunk_state_c
=
model
(
paddle
.
to_tensor
(
audio_chunk
),
paddle
.
to_tensor
(
audio_chunk_lens
),
...
...
speechx/examples/ds2_ol/onnx/local/onnx_clone.sh
100644 → 100755
浏览文件 @
1c9eb445
文件模式从 100644 更改为 100755
speechx/examples/ds2_ol/onnx/local/onnx_infer_shape.py
100644 → 100755
浏览文件 @
1c9eb445
文件模式从 100644 更改为 100755
speechx/examples/ds2_ol/onnx/local/onnx_opt.sh
浏览文件 @
1c9eb445
#!/bin/bash
set
-e
if
[
$#
!=
3
]
;
then
# ./local/onnx_opt.sh model.old.onnx model.opt.onnx "audio_chunk:1,-1,161 audio_chunk_lens:1 chunk_state_c_box:5,1,1024 chunk_state_h_box:5,1,1024"
echo
"usage:
$0
onnx.model.in onnx.model.out input_shape "
exit
1
fi
# onnx optimizer
onnx-simplifier
\ No newline at end of file
pip
install
onnx-simplifier
in
=
$1
out
=
$2
input_shape
=
$3
check_n
=
3
onnxsim
$in
$2
$check_n
--dynamic-input-shape
--input-shape
$input_shape
\ No newline at end of file
speechx/examples/ds2_ol/onnx/local/onnx_prune_model.py
100644 → 100755
浏览文件 @
1c9eb445
文件模式从 100644 更改为 100755
speechx/examples/ds2_ol/onnx/run.sh
浏览文件 @
1c9eb445
...
...
@@ -53,6 +53,15 @@ fi
if
[
${
stage
}
-le
3
]
&&
[
${
stop_stage
}
-ge
3
]
;
then
# to onnx
./local/tonnx.sh
$dir
$model
$param
$exp
/model.onnx
./local/infer_check.py
--input_file
'static_ds2online_inputs.pickle'
--model_dir
$dir
--onnx_model
$exp
/model.onnx
fi
if
[
${
stage
}
-le
4
]
&&
[
${
stop_stage
}
-ge
4
]
;
then
input_shape
=
"audio_chunk:1,-1,161 audio_chunk_lens:1 chunk_state_c_box:5,1,1024 chunk_state_h_box:5,1,1024"
# simplifying onnx model
./local/onnx_opt.sh
$exp
/model.onnx
$exp
/model.opt.onnx
$input_shape
./local/infer_check.py
--input_file
'static_ds2online_inputs.pickle'
--model_dir
$dir
--onnx_model
$exp
/model.opt.onnx
fi
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录