Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
7c3a11cc
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
206
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7c3a11cc
编写于
3月 10, 2022
作者:
K
KP
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add benchmark.
上级
48167eb9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
208 addition
and
0 deletion
+208
-0
paddleaudio/tests/benchmark/README.md
paddleaudio/tests/benchmark/README.md
+45
-0
paddleaudio/tests/benchmark/features/__init__.py
paddleaudio/tests/benchmark/features/__init__.py
+13
-0
paddleaudio/tests/benchmark/features/log_mel_spectrogram.py
paddleaudio/tests/benchmark/features/log_mel_spectrogram.py
+50
-0
paddleaudio/tests/benchmark/features/mel_spectrogram.py
paddleaudio/tests/benchmark/features/mel_spectrogram.py
+50
-0
paddleaudio/tests/benchmark/features/mfcc.py
paddleaudio/tests/benchmark/features/mfcc.py
+50
-0
未找到文件。
paddleaudio/tests/benchmark/README.md
0 → 100644
浏览文件 @
7c3a11cc
# 1. Prepare
First, install
`line_profiler`
via pip.
```
sh
pip
install
line_profiler
```
# 2. Run
Run the specific script for profiling.
```
sh
kernprof
-l
features/mel_spectrogram.py
python
-m
line_profiler
-u
1e-3 mel_spectrogram.py.lprof
```
Result:
```
sh
Timer unit: 0.001 s
Total
time
: 22.1208 s
File: features/mel_spectrogram.py
Function: test_melspect_cpu at line 13
Line
# Hits Time Per Hit % Time Line Contents
==============================================================
13 @profile
14 def test_melspect_cpu
(
input_shape,
times
)
:
15 1 0.1 0.1 0.0 paddle.set_device
(
'cpu'
)
16 1 234.5 234.5 1.1 x
=
paddle.randn
(
input_shape
)
17 1 85.3 85.3 0.4 feature_extractor
=
paddleaudio.features.MelSpectrogram
(
**
feat_conf,
dtype
=
x.dtype
)
18 101 0.5 0.0 0.0
for
i
in
range
(
times
)
:
19 100 21800.5 218.0 98.6 y
=
feature_extractor
(
x
)
Total
time
: 4.80543 s
File: features/mel_spectrogram.py
Function: test_melspect_gpu at line 22
Line
# Hits Time Per Hit % Time Line Contents
==============================================================
22 @profile
23 def test_melspect_gpu
(
input_shape,
times
)
:
24 1 0.5 0.5 0.0 paddle.set_device
(
'gpu'
)
25 1 4144.8 4144.8 86.3 x
=
paddle.randn
(
input_shape
)
26 1 41.9 41.9 0.9 feature_extractor
=
paddleaudio.features.MelSpectrogram
(
**
feat_conf,
dtype
=
x.dtype
)
27 101 0.2 0.0 0.0
for
i
in
range
(
times
)
:
28 100 618.1 6.2 12.9 y
=
feature_extractor
(
x
)
```
paddleaudio/tests/benchmark/features/__init__.py
0 → 100644
浏览文件 @
7c3a11cc
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
paddleaudio/tests/benchmark/features/log_mel_spectrogram.py
0 → 100644
浏览文件 @
7c3a11cc
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle
import
paddleaudio
feat_conf
=
{
'sr'
:
16000
,
'n_fft'
:
512
,
'hop_length'
:
128
,
'n_mels'
:
40
,
'f_min'
:
0.0
,
}
@
profile
def
test_log_melspect_cpu
(
input_shape
,
times
):
paddle
.
set_device
(
'cpu'
)
x
=
paddle
.
randn
(
input_shape
)
feature_extractor
=
paddleaudio
.
features
.
LogMelSpectrogram
(
**
feat_conf
,
dtype
=
x
.
dtype
)
for
i
in
range
(
times
):
y
=
feature_extractor
(
x
)
@
profile
def
test_log_melspect_gpu
(
input_shape
,
times
):
paddle
.
set_device
(
'gpu'
)
x
=
paddle
.
randn
(
input_shape
)
feature_extractor
=
paddleaudio
.
features
.
LogMelSpectrogram
(
**
feat_conf
,
dtype
=
x
.
dtype
)
for
i
in
range
(
times
):
y
=
feature_extractor
(
x
)
input_shape
=
(
16
,
48000
)
# (N, T)
times
=
100
test_log_melspect_cpu
(
input_shape
,
times
)
test_log_melspect_gpu
(
input_shape
,
times
)
paddleaudio/tests/benchmark/features/mel_spectrogram.py
0 → 100644
浏览文件 @
7c3a11cc
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle
import
paddleaudio
feat_conf
=
{
'sr'
:
16000
,
'n_fft'
:
512
,
'hop_length'
:
128
,
'n_mels'
:
40
,
'f_min'
:
0.0
,
}
@
profile
def
test_melspect_cpu
(
input_shape
,
times
):
paddle
.
set_device
(
'cpu'
)
x
=
paddle
.
randn
(
input_shape
)
feature_extractor
=
paddleaudio
.
features
.
MelSpectrogram
(
**
feat_conf
,
dtype
=
x
.
dtype
)
for
i
in
range
(
times
):
y
=
feature_extractor
(
x
)
@
profile
def
test_melspect_gpu
(
input_shape
,
times
):
paddle
.
set_device
(
'gpu'
)
x
=
paddle
.
randn
(
input_shape
)
feature_extractor
=
paddleaudio
.
features
.
MelSpectrogram
(
**
feat_conf
,
dtype
=
x
.
dtype
)
for
i
in
range
(
times
):
y
=
feature_extractor
(
x
)
input_shape
=
(
16
,
48000
)
# (N, T)
times
=
100
test_melspect_cpu
(
input_shape
,
times
)
test_melspect_gpu
(
input_shape
,
times
)
paddleaudio/tests/benchmark/features/mfcc.py
0 → 100644
浏览文件 @
7c3a11cc
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle
import
paddleaudio
feat_conf
=
{
'sr'
:
16000
,
'n_mfcc'
:
20
,
'n_fft'
:
512
,
'hop_length'
:
128
,
'n_mels'
:
40
,
'f_min'
:
0.0
,
'top_db'
:
80.0
,
}
@
profile
def
test_mfcc_cpu
(
input_shape
,
times
):
paddle
.
set_device
(
'cpu'
)
x
=
paddle
.
randn
(
input_shape
)
feature_extractor
=
paddleaudio
.
features
.
MFCC
(
**
feat_conf
,
dtype
=
x
.
dtype
)
for
i
in
range
(
times
):
y
=
feature_extractor
(
x
)
@
profile
def
test_mfcc_gpu
(
input_shape
,
times
):
paddle
.
set_device
(
'gpu'
)
x
=
paddle
.
randn
(
input_shape
)
feature_extractor
=
paddleaudio
.
features
.
MFCC
(
**
feat_conf
,
dtype
=
x
.
dtype
)
for
i
in
range
(
times
):
y
=
feature_extractor
(
x
)
input_shape
=
(
16
,
48000
)
# (N, T)
times
=
100
test_mfcc_cpu
(
input_shape
,
times
)
test_mfcc_gpu
(
input_shape
,
times
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录