Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
bb8785c6
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
207
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,发现更多精彩内容 >>
未验证
提交
bb8785c6
编写于
4月 27, 2022
作者:
H
Hui Zhang
提交者:
GitHub
4月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1815 from zh794390558/bugfix
[speechx] fix speechx core dump when stop immediately after start
上级
2a661fcd
fc96130f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
20 deletion
+22
-20
paddlespeech/cli/cls/infer.py
paddlespeech/cli/cls/infer.py
+2
-2
paddlespeech/s2t/__init__.py
paddlespeech/s2t/__init__.py
+0
-2
paddlespeech/server/bin/paddlespeech_client.py
paddlespeech/server/bin/paddlespeech_client.py
+1
-1
paddlespeech/server/utils/audio_handler.py
paddlespeech/server/utils/audio_handler.py
+4
-7
speechx/speechx/decoder/ctc_tlg_decoder.cc
speechx/speechx/decoder/ctc_tlg_decoder.cc
+6
-0
speechx/speechx/websocket/websocket_server.cc
speechx/speechx/websocket/websocket_server.cc
+9
-8
未找到文件。
paddlespeech/cli/cls/infer.py
浏览文件 @
bb8785c6
...
...
@@ -21,6 +21,8 @@ from typing import Union
import
numpy
as
np
import
paddle
import
yaml
from
paddleaudio
import
load
from
paddleaudio.features
import
LogMelSpectrogram
from
..executor
import
BaseExecutor
from
..log
import
logger
...
...
@@ -28,8 +30,6 @@ from ..utils import cli_register
from
..utils
import
stats_wrapper
from
.pretrained_models
import
model_alias
from
.pretrained_models
import
pretrained_models
from
paddleaudio
import
load
from
paddleaudio.features
import
LogMelSpectrogram
from
paddlespeech.s2t.utils.dynamic_import
import
dynamic_import
__all__
=
[
'CLSExecutor'
]
...
...
paddlespeech/s2t/__init__.py
浏览文件 @
bb8785c6
...
...
@@ -325,7 +325,6 @@ if not hasattr(paddle.Tensor, 'type_as'):
setattr
(
paddle
.
static
.
Variable
,
'type_as'
,
type_as
)
def
to
(
x
:
paddle
.
Tensor
,
*
args
,
**
kwargs
)
->
paddle
.
Tensor
:
assert
len
(
args
)
==
1
if
isinstance
(
args
[
0
],
str
):
# dtype
...
...
@@ -372,7 +371,6 @@ if not hasattr(paddle.Tensor, 'tolist'):
"register user tolist to paddle.Tensor, remove this when fixed!"
)
setattr
(
paddle
.
Tensor
,
'tolist'
,
tolist
)
setattr
(
paddle
.
static
.
Variable
,
'tolist'
,
tolist
)
########### hack paddle.nn #############
from
paddle.nn
import
Layer
...
...
paddlespeech/server/bin/paddlespeech_client.py
浏览文件 @
bb8785c6
...
...
@@ -521,4 +521,4 @@ class TextClientExecutor(BaseExecutor):
res
=
requests
.
post
(
url
=
url
,
data
=
json
.
dumps
(
request
))
response_dict
=
res
.
json
()
punc_text
=
response_dict
[
"result"
][
"punc_text"
]
return
punc_text
\ No newline at end of file
return
punc_text
paddlespeech/server/utils/audio_handler.py
浏览文件 @
bb8785c6
...
...
@@ -91,8 +91,7 @@ class ASRWsAudioHandler:
if
url
is
None
or
port
is
None
or
endpoint
is
None
:
self
.
url
=
None
else
:
self
.
url
=
"ws://"
+
self
.
url
+
":"
+
str
(
self
.
port
)
+
endpoint
self
.
url
=
"ws://"
+
self
.
url
+
":"
+
str
(
self
.
port
)
+
endpoint
self
.
punc_server
=
TextHttpHandler
(
punc_server_ip
,
punc_server_port
)
logger
.
info
(
f
"endpoint:
{
self
.
url
}
"
)
...
...
@@ -139,8 +138,7 @@ class ASRWsAudioHandler:
logging
.
info
(
"send a message to the server"
)
if
self
.
url
is
None
:
logger
.
error
(
"No asr server, please input valid ip and port"
)
logger
.
error
(
"No asr server, please input valid ip and port"
)
return
""
# 1. send websocket handshake protocal
...
...
@@ -167,8 +165,7 @@ class ASRWsAudioHandler:
msg
=
json
.
loads
(
msg
)
if
self
.
punc_server
and
len
(
msg
[
"result"
])
>
0
:
msg
[
"result"
]
=
self
.
punc_server
.
run
(
msg
[
"result"
])
msg
[
"result"
]
=
self
.
punc_server
.
run
(
msg
[
"result"
])
logger
.
info
(
"client receive msg={}"
.
format
(
msg
))
# 4. we must send finished signal to the server
...
...
@@ -189,7 +186,7 @@ class ASRWsAudioHandler:
if
self
.
punc_server
:
msg
[
"result"
]
=
self
.
punc_server
.
run
(
msg
[
"result"
])
logger
.
info
(
"client final receive msg={}"
.
format
(
msg
))
result
=
msg
...
...
speechx/speechx/decoder/ctc_tlg_decoder.cc
浏览文件 @
bb8785c6
...
...
@@ -48,6 +48,12 @@ void TLGDecoder::Reset() {
}
std
::
string
TLGDecoder
::
GetFinalBestPath
()
{
if
(
frame_decoded_size_
==
0
)
{
// Assertion failed: (this->NumFramesDecoded() > 0 && "You cannot call
// BestPathEnd if no frames were decoded.")
return
std
::
string
(
""
);
}
decoder_
->
FinalizeDecoding
();
kaldi
::
Lattice
lat
;
kaldi
::
LatticeWeight
weight
;
...
...
speechx/speechx/websocket/websocket_server.cc
浏览文件 @
bb8785c6
...
...
@@ -27,21 +27,22 @@ ConnectionHandler::ConnectionHandler(
:
ws_
(
std
::
move
(
socket
)),
recognizer_resource_
(
recognizer_resource
)
{}
void
ConnectionHandler
::
OnSpeechStart
()
{
LOG
(
INFO
)
<<
"Server: Recieved speech start signal, start reading speech"
;
got_start_tag_
=
true
;
json
::
value
rv
=
{{
"status"
,
"ok"
},
{
"type"
,
"server_ready"
}};
ws_
.
text
(
true
);
ws_
.
write
(
asio
::
buffer
(
json
::
serialize
(
rv
)));
recognizer_
=
std
::
make_shared
<
Recognizer
>
(
recognizer_resource_
);
// Start decoder thread
decode_thread_
=
std
::
make_shared
<
std
::
thread
>
(
&
ConnectionHandler
::
DecodeThreadFunc
,
this
);
got_start_tag_
=
true
;
LOG
(
INFO
)
<<
"Server: Recieved speech start signal, start reading speech"
;
json
::
value
rv
=
{{
"status"
,
"ok"
},
{
"type"
,
"server_ready"
}};
ws_
.
text
(
true
);
ws_
.
write
(
asio
::
buffer
(
json
::
serialize
(
rv
)));
}
void
ConnectionHandler
::
OnSpeechEnd
()
{
LOG
(
INFO
)
<<
"Server: Recieved speech end signal"
;
CHECK
(
recognizer_
!=
nullptr
);
recognizer_
->
SetFinished
();
if
(
recognizer_
!=
nullptr
)
{
recognizer_
->
SetFinished
();
}
got_end_tag_
=
true
;
}
...
...
@@ -158,7 +159,7 @@ void ConnectionHandler::operator()() {
}
}
LOG
(
INFO
)
<<
"Server:
Read all pcm data, wait for decoding thread
"
;
LOG
(
INFO
)
<<
"Server:
finished to wait for decoding thread join.
"
;
if
(
decode_thread_
!=
nullptr
)
{
decode_thread_
->
join
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录