Comments (27)
Hello,
we have been experiencing the same errors described above with sherpa-onnx 1.9.23 in Ubuntu environment. We have observed the errors at variable frequency, 1-10 cases per 1000 utterances. They occur with various models (base/small/medium/large, int8/float), but mostly with English monolingual models. A part of problematic audio files seem to cause a timeout and do not get transcribed on the Huggingface API available under https://huggingface.co/spaces/k2-fsa/automatic-speech-recognition either. Monitoring the decoding (logging tokens in the for cycle around line 100 looping over text_ctx) we observe that repetitive patterns occur and the EoT is never reached until the cycle runs out. Sometimes the speaker makes indeed repetitions (like repeating a word many times, 5 times or above) sometimes there is no evident cause of getting stuck in a repetitive loop of tokens without reaching EoT. Increasing the tail paddings helped only a very little for us.
Through monitoring the predicted_tokens buffer, we attempted to detect if repetitions start to occur and force an EoT after a critical number of repetitions have occured. This efficiently prevented getting stuck and endig up in an empty transcript with all of our problem utterances. We were trying resetting instead of stopping, but the majority of utterances got stuck again and just some finished with success. The drawback of forcing EoT is that the tail of the audio will not be transcribed. But it helps at least preventing spending a lot of time in the for loop. I am wondering if a more advanced fix is available for the problem?
If there is an interest to review this small code extension, let me know, I am happy to create a PR on a fork or just copy-paste the changes since they are not abundant.
Thank you!
from sherpa-onnx.
Could you describe how you created the APK?
Does it work with the APK from us?
from sherpa-onnx.
No it crashes the same way. You can reproduce this error with SherpaOnnx2Pass
app.
Use sherpa-onnx-whisper-base.en
model.
from sherpa-onnx.
Device arch: arm64-v8a, armeabi-v7a
Just want to re-check that you are using sherpa-onnx 1.9.11, right?
That is, are you using this commit #617 ?
from sherpa-onnx.
Yes I use version 1.9.11, but I've also tried with the last commit from master #5dc2eaf
from sherpa-onnx.
Btw, this warning is printed sometime before this exception happened:
Overflow! n: 3200, size: 960000, n+size: 963200, capacity: 960000. Increase capacity to: 1920000
from sherpa-onnx.
Could you tell us whether you are using our apk, or write your own?
Also, are you using the code from #617?
Please give us more information.
from sherpa-onnx.
Yes I use your example project SherpaOnnx2Pass with v1.9.11, so code from #617 is used.
Nothing is changed from your codebase. Just build your APK, and start recording an audio long enough and this error happens
from sherpa-onnx.
start recording an audio long enough
How long is this audio?
Are there pauses? If yes, how long is the pause?
from sherpa-onnx.
Audio used is a 5 minutes conversation, with pauses.
But the error can happen after a couple of seconds or minutes, depending the phone
from sherpa-onnx.
Does it cause a crash or the APP can continue work?
from sherpa-onnx.
No the app doesn't crash. It's an exception printed in the logs
from sherpa-onnx.
How many exceptions did you see? One or many?
from sherpa-onnx.
There can be several per session
from sherpa-onnx.
Does it affect the final recognition result?
These logs are only available in logcat.
from sherpa-onnx.
Yes because when this error occurs the call to decode may freeze for a long time (~10 to 30 seconds) and no results will be returned.
from sherpa-onnx.
It's seams this happens when this condition offline-whisper-greedy-search-decoder.cc#L148 is not reached:
if (max_token_id == model_->EOT()) {
break;
}
Then model_->ForwardDecoder()
will be called too many times and will end up throwing an exception
from sherpa-onnx.
Non-zero status code returned while running Expand node. Name:'/Expand' Status Message: invalid expand shape
Return an empty result. Number of input frames: 300, Current tail paddings: 1000. If you see a lot of such exceptions, please consider using a larger --whisper-tail-paddings
Could you use a larger tail padding? You can always use 30000
to restore the 30 seconds constraint of the original whisper model.
from sherpa-onnx.
With a padding of 30000
it works better, but then decoding is too long. I would like to keep a small padding
from sherpa-onnx.
The problem is introduced by our modification to whisper.
The original whisper needs 30 seconds of input. If the input is less than 30, then it is padded to 30, which means it has enough padding to detect the EoT.
In the current change, we remove the 30 seconds constraint and if the padding is small, then it may not abe able to detect the EoT. As described in #633 (comment), restore the original behavior by padding the input to 30 seconds can fix the issue, at the cost of extra computations for extra paddings.
from sherpa-onnx.
Actually, our problem is that despite using a padding of 30000, we are still getting invalid shape error and an empty transcript.
Here is the call:
sherpa-onnx-offline --whisper-tail-paddings=30000 --whisper-encoder=base.en-encoder.int8.onnx --whisper-decoder=base.en-decoder.int8.onnx base.en-tokens.txt --num-threads=1 --provider=cpu samples/problem_1.wav
I can see this utterance gets stuck in repeating tokens 11 and 607 alternately until n_text_ctx is reached with no EoT at the end at all.
from sherpa-onnx.
Can the official whisper implementation decode your problem_1.wav
correctly?
from sherpa-onnx.
Yes, it can. (I have also double checked that sherpa-onnx versions match , I mean I am using the same version for decoding which was used during export.)
from sherpa-onnx.
Would you mind sharing.the wav file with.us?
from sherpa-onnx.
Unfortunately I can't, I am bound by severe data privacy constraints. It may however be of importance, that the majority of the utterances I deal with contain non-native English speech (the whisper model is not fine-tuned). I have so far a couple of problem utterances, as I wrote earlier, some indeed contain repetitions where decoding gets stuck at the repeated word. Others seem to be quite standard utterances.
from sherpa-onnx.
Hi @csukuangfj , I have a new sample producing the same error, I am able to share it with you by discarding third party public. Please let me know if you can accept the file and if so, the way I could send it to you. Thank you.
from sherpa-onnx.
Hi @csukuangfj , I have a new sample producing the same error, I am able to share it with you by discarding third party public. Please let me know if you can accept the file and if so, the way I could send it to you. Thank you.
Thanks!
Could you send the test wave to
csukuangfj at gmail dot com
from sherpa-onnx.
Related Issues (20)
- 在做ASR时,如果对麦克风收音做降噪处理? HOT 2
- TTS,除了命令行调用外,能否在Python里直接调用?想避免模型重复加载耗时 HOT 4
- [Help wanted] Add OnlineNeMoCtcModelConfig to C API
- [Help wanted] Flutter APP for text-to-speech HOT 1
- 把SherpaOnnx 样例的Android kotlin代码转成Java就无法识别声音 HOT 3
- 如何调节输出音频的音量 HOT 1
- The command line tool named 'sherpa-onnx-cli' for convert the original keywords to tokens HOT 2
- [feature request] remember speed HOT 3
- [csharp] SpeakerEmbeddingExtractor cost memory 6G and keep growing, does it normal or has memory leak? HOT 8
- [csharp] SherpaOfflinePunctuationAddPunct. Unhandled exception. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception HOT 2
- 安装Python Package CUDA版本失败 HOT 25
- whisper onnx convert to rknn HOT 6
- Hotwords encoding for phonemes HOT 6
- Getting end timestamp in result(s) HOT 2
- Runtime option to disable sherpa logs HOT 2
- Import Piper / VITS as iOS Custom System Voices for TTS using AVSpeechSynthesisProviderAudioUnit Extension in Swift HOT 1
- Convert new piper tts models. HOT 1
- Multi-language support issue with Sherpa ONNX conversion (on android device) HOT 3
- Use offline model to stream online HOT 1
- Errors and Questions regarding exporting a model HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sherpa-onnx.