Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
8271fcfb
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,发现更多精彩内容 >>
提交
8271fcfb
编写于
10月 24, 2022
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix as comment
上级
08c432f7
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
42 addition
and
31 deletion
+42
-31
speechx/CMakeLists.txt
speechx/CMakeLists.txt
+24
-3
speechx/README.md
speechx/README.md
+2
-2
speechx/cmake/paddleinference.cmake
speechx/cmake/paddleinference.cmake
+0
-9
speechx/examples/codelab/feat/run.sh
speechx/examples/codelab/feat/run.sh
+3
-3
speechx/examples/codelab/u2/local/decode.sh
speechx/examples/codelab/u2/local/decode.sh
+1
-1
speechx/speechx/decoder/CMakeLists.txt
speechx/speechx/decoder/CMakeLists.txt
+5
-5
speechx/speechx/decoder/ctc_beam_search_opt.h
speechx/speechx/decoder/ctc_beam_search_opt.h
+2
-3
speechx/speechx/decoder/ctc_prefix_beam_search_decoder.cc
speechx/speechx/decoder/ctc_prefix_beam_search_decoder.cc
+3
-3
speechx/speechx/decoder/ctc_prefix_beam_search_decoder.h
speechx/speechx/decoder/ctc_prefix_beam_search_decoder.h
+2
-2
未找到文件。
speechx/CMakeLists.txt
浏览文件 @
8271fcfb
...
...
@@ -102,7 +102,16 @@ message(STATUS "Pybind11_INCLUDES = ${pybind11_INCLUDE_DIRS}, pybind11_LIBRARIES
# paddle include and link option
# -L/workspace/DeepSpeech-2.x/speechx/venv/lib/python3.7/site-packages/paddle/libs -L/workspace/DeepSpeech-2.x/speechx/venv/lib/python3.7/site-packages/paddle/fluid -l:libpaddle.so -l:libdnnl.so.2 -l:libiomp5.so
execute_process
(
COMMAND python -c
"import os; import paddle; include_dir=paddle.sysconfig.get_include(); paddle_dir=os.path.split(include_dir)[0]; libs_dir=os.path.join(paddle_dir, 'libs'); fluid_dir=os.path.join(paddle_dir, 'fluid'); out=' '.join([
\"
-L
\"
+ libs_dir,
\"
-L
\"
+ fluid_dir]); out +=
\"
-l:libpaddle.so -l:libdnnl.so.2 -l:libiomp5.so
\"
; print(out);"
COMMAND python -c
"\
import os;\
import paddle;\
include_dir=paddle.sysconfig.get_include();\
paddle_dir=os.path.split(include_dir)[0];\
libs_dir=os.path.join(paddle_dir, 'libs');\
fluid_dir=os.path.join(paddle_dir, 'fluid');\
out=' '.join([
\"
-L
\"
+ libs_dir,
\"
-L
\"
+ fluid_dir]);\
out +=
\"
-l:libpaddle.so -l:libdnnl.so.2 -l:libiomp5.so
\"
; print(out);\
"
OUTPUT_VARIABLE PADDLE_LINK_FLAGS
RESULT_VARIABLE SUCESS
)
...
...
@@ -112,7 +121,11 @@ string(STRIP ${PADDLE_LINK_FLAGS} PADDLE_LINK_FLAGS)
# paddle compile option
# -I/workspace/DeepSpeech-2.x/speechx/venv/lib/python3.7/site-packages/paddle/include
execute_process
(
COMMAND python -c
"import paddle; include_dir = paddle.sysconfig.get_include(); print(f
\"
-I{include_dir}
\"
);"
COMMAND python -c
"\
import paddle; \
include_dir = paddle.sysconfig.get_include(); \
print(f
\"
-I{include_dir}
\"
); \
"
OUTPUT_VARIABLE PADDLE_COMPILE_FLAGS
)
message
(
STATUS PADDLE_COMPILE_FLAGS=
${
PADDLE_COMPILE_FLAGS
}
)
string
(
STRIP
${
PADDLE_COMPILE_FLAGS
}
PADDLE_COMPILE_FLAGS
)
...
...
@@ -121,7 +134,15 @@ string(STRIP ${PADDLE_COMPILE_FLAGS} PADDLE_COMPILE_FLAGS)
# for LD_LIBRARY_PATH
# set(PADDLE_LIB_DIRS /workspace/DeepSpeech-2.x/tools/venv/lib/python3.7/site-packages/paddle/fluid:/workspace/DeepSpeech-2.x/tools/venv/lib/python3.7/site-packages/paddle/libs/)
execute_process
(
COMMAND python -c
"import os; import paddle; include_dir=paddle.sysconfig.get_include(); paddle_dir=os.path.split(include_dir)[0]; libs_dir=os.path.join(paddle_dir, 'libs'); fluid_dir=os.path.join(paddle_dir, 'fluid'); out=':'.join([libs_dir, fluid_dir]); print(out);"
COMMAND python -c
" \
import os; \
import paddle; \
include_dir=paddle.sysconfig.get_include(); \
paddle_dir=os.path.split(include_dir)[0]; \
libs_dir=os.path.join(paddle_dir, 'libs'); \
fluid_dir=os.path.join(paddle_dir, 'fluid'); \
out=':'.join([libs_dir, fluid_dir]); print(out); \
"
OUTPUT_VARIABLE PADDLE_LIB_DIRS
)
message
(
STATUS PADDLE_LIB_DIRS=
${
PADDLE_LIB_DIRS
}
)
...
...
speechx/README.md
浏览文件 @
8271fcfb
...
...
@@ -9,7 +9,7 @@ We develop under:
*
gcc/g++/gfortran - 8.2.0
*
cmake - 3.16.0
> Please us
ing
`tools/env.sh` to create python `venv`, then `source venv/bin/activate` to build speechx.
> Please us
e
`tools/env.sh` to create python `venv`, then `source venv/bin/activate` to build speechx.
> We make sure all things work fun under docker, and recommend using it to develop and deploy.
...
...
@@ -35,7 +35,7 @@ bash tools/venv.sh
2.
Build
`speechx`
and
`examples`
.
For now we
using feature under
`develop`
branch of paddle, so we need
install
`paddlepaddle`
nightly build version.
For now we
are using feature under
`develop`
branch of paddle, so we need to
install
`paddlepaddle`
nightly build version.
For example:
```
source venv/bin/activate
...
...
speechx/cmake/paddleinference.cmake
浏览文件 @
8271fcfb
set
(
paddle_SOURCE_DIR
${
fc_patch
}
/paddle-lib
)
set
(
paddle_PREFIX_DIR
${
fc_patch
}
/paddle-lib-prefix
)
# ExternalProject_Add(paddle
# URL https://paddle-inference-lib.bj.bcebos.com/2.2.2/cxx_c/Linux/CPU/gcc8.2_avx_mkl/paddle_inference.tgz
# URL_HASH SHA256=7c6399e778c6554a929b5a39ba2175e702e115145e8fa690d2af974101d98873
# PREFIX ${paddle_PREFIX_DIR}
# SOURCE_DIR ${paddle_SOURCE_DIR}
# CONFIGURE_COMMAND ""
# BUILD_COMMAND ""
# INSTALL_COMMAND ""
# )
include
(
FetchContent
)
FetchContent_Declare
(
...
...
speechx/examples/codelab/feat/run.sh
浏览文件 @
8271fcfb
...
...
@@ -42,8 +42,8 @@ mkdir -p $exp_dir
export
GLOG_logtostderr
=
1
cmvn_json2kaldi_main
\
--json_file
$model_dir
/data/mean_std.json
\
--cmvn_write_path
$exp_dir
/cmvn.ark
\
--json_file
=
$model_dir
/data/mean_std.json
\
--cmvn_write_path
=
$exp_dir
/cmvn.ark
\
--binary
=
false
echo
"convert json cmvn to kaldi ark."
...
...
@@ -55,7 +55,7 @@ compute_linear_spectrogram_main \
echo
"compute linear spectrogram feature."
compute_fbank_main
\
--num_bins
161
\
--num_bins
=
161
\
--wav_rspecifier
=
scp:
$data_dir
/wav.scp
\
--feature_wspecifier
=
ark,t:
$exp_dir
/fbank.ark
\
--cmvn_file
=
$exp_dir
/cmvn.ark
...
...
speechx/examples/codelab/u2/local/decode.sh
浏览文件 @
8271fcfb
...
...
@@ -7,7 +7,7 @@ set -e
data
=
data
exp
=
exp
mkdir
-p
$exp
ckpt_dir
=
./
data/model
ckpt_dir
=
$
data
/model
model_dir
=
$ckpt_dir
/asr1_chunk_conformer_u2pp_wenetspeech_static_1.1.0.model/
ctc_prefix_beam_search_decoder_main
\
...
...
speechx/speechx/decoder/CMakeLists.txt
浏览文件 @
8271fcfb
...
...
@@ -4,11 +4,11 @@ set(srcs)
if
(
USING_DS2
)
list
(
APPEND srcs
ctc_decoders/decoder_utils.cpp
ctc_decoders/path_trie.cpp
ctc_decoders/scorer.cpp
ctc_beam_search_decoder.cc
ctc_tlg_decoder.cc
ctc_decoders/decoder_utils.cpp
ctc_decoders/path_trie.cpp
ctc_decoders/scorer.cpp
ctc_beam_search_decoder.cc
ctc_tlg_decoder.cc
)
endif
()
...
...
speechx/speechx/decoder/ctc_beam_search_opt.h
浏览文件 @
8271fcfb
...
...
@@ -11,12 +11,11 @@
// 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.
#pragma once
#include "base/common.h"
#include "util/parse-options.h"
#pragma once
namespace
ppspeech
{
...
...
speechx/speechx/decoder/ctc_prefix_beam_search_decoder.cc
浏览文件 @
8271fcfb
...
...
@@ -107,12 +107,12 @@ void CTCPrefixBeamSearch::AdvanceDecoding(
std
::
min
(
static_cast
<
int
>
(
logp
[
0
].
size
()),
opts_
.
first_beam_size
);
for
(
int
t
=
0
;
t
<
logp
.
size
();
++
t
,
++
num_frame_decoded_
)
{
const
std
::
vector
<
f
loat
>&
logp_t
=
logp
[
t
];
const
std
::
vector
<
kaldi
::
BaseF
loat
>&
logp_t
=
logp
[
t
];
std
::
unordered_map
<
std
::
vector
<
int
>
,
PrefixScore
,
PrefixScoreHash
>
next_hyps
;
// 1. first beam prune, only select topk candidates
std
::
vector
<
f
loat
>
topk_score
;
std
::
vector
<
kaldi
::
BaseF
loat
>
topk_score
;
std
::
vector
<
int32_t
>
topk_index
;
TopK
(
logp_t
,
first_beam_size
,
&
topk_score
,
&
topk_index
);
VLOG
(
2
)
<<
"topk: "
<<
num_frame_decoded_
<<
" "
...
...
speechx/speechx/decoder/ctc_prefix_beam_search_decoder.h
浏览文件 @
8271fcfb
...
...
@@ -27,7 +27,7 @@ namespace ppspeech {
class
ContextGraph
;
class
CTCPrefixBeamSearch
:
public
DecoderBase
{
public:
explicit
CTCPrefixBeamSearch
(
const
std
::
string
&
vocab_path
,
CTCPrefixBeamSearch
(
const
std
::
string
&
vocab_path
,
const
CTCBeamSearchOptions
&
opts
);
~
CTCPrefixBeamSearch
()
{}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录