Open Mddct opened 2 years ago
[{"sentence":"甚至"}] [{"sentence":"甚至出现"}] [{"sentence":"甚至出现交易几"}] [{"sentence":"甚至出现交易几乎停滞"}] [{"sentence":"甚至出现交易几乎停滞的情"}]
decoder = wenet.StreammingAsrDecoder(model)
# simulating streamming
def send():
# decoder.AcceptWaveform(b, True)
# return
nbytes = int((16000/1000)*2*800)
final = False
r = nbytes
l = 0
while True:
if r == len(b):
final = False
l = 0
r = nbytes
decoder.AcceptWaveform(b[l:r], final)
l = r
if l >= len(b):
break
if r + nbytes < len(b):
r = r + nbytes
else:
r = len(b)
t = threading.Thread(target=send)
t.start()
#send()
#decoder.Reset()
#decoder.Reset()
#send()
for res in decoder.GetInstanceResult():
print(str(res))
t.join()
when gil is hold in send thread, these is no chance running "for res in decoder.GetInstanceResult():" so if AcceptWaveform is passing to c++, c++ code should release gil lock in some way
https://github.com/pybind/pybind11/issues/1723