k2-fsa / sherpa-onnx

Speech-to-text, text-to-speech, speaker recognition, and VAD using next-gen Kaldi with onnxruntime without Internet connection. Support embedded systems, Android, iOS, Raspberry Pi, RISC-V, x86_64 servers, websocket server/client, C/C++, Python, Kotlin, C#, Go, NodeJS, Java, Swift, Dart, JavaScript, Flutter, Object Pascal, Lazarus, Rust

Home Page:https://k2-fsa.github.io/sherpa/onnx/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TTS crashes with nnapi enabled (works with CPU)

l3utterfly opened this issue · comments

Here is the error message:

---vits model---
                                                                                                    sample_rate=22050
                                                                                                    has_espeak=1
                                                                                                    comment=piper
                                                                                                    n_speakers=1
                                                                                                    voice=en-us
                                                                                                    language=English
                                                                                                    model_type=vits
                                                                                                    ----------input names----------
                                                                                                    0 input
                                                                                                    1 input_lengths
                                                                                                    2 scales
                                                                                                    ----------output names----------
                                                                                                    0 output
2024-06-02 18:58:52.961 16536-17804 sherpa-onnx             com.layla                            W  string is: What can I do for you today?
2024-06-02 18:58:52.961 16536-17804 sherpa-onnx             com.layla                            W  Raw text: What can I do for you today?
2024-06-02 18:58:52.995 16536-17805 CpuExecutor             com.layla                            E  Invalid dimensions for model operand: packages/modules/NeuralNetworks/common/types/src/TypeUtils.cpp:249: Incompatible ranks: [1] and [1, 1]
2024-06-02 18:58:52.995 16536-17805 CpuExecutor             com.layla                            E  GATHER failed.
2024-06-02 18:58:52.995 16536-17804 onnxruntime             com.layla                            E   [E:onnxruntime:, sequential_executor.cc:514 ExecuteKernel] Non-zero status code returned while running Nnapi_17332806132420531993_0 node. Name:'NnapiExecutionProvider_Nnapi_17332806132420531993_0_0' Status Message: model.cc:195 Predict ResultCode: ANEURALNETWORKS_OP_FAILED
2024-06-02 18:58:53.008 16536-17804 libc++abi               com.layla                            E  terminating with uncaught exception of type Ort::Exception: Non-zero status code returned while running Nnapi_17332806132420531993_0 node. Name:'NnapiExecutionProvider_Nnapi_17332806132420531993_0_0' Status Message: model.cc:195 Predict ResultCode: ANEURALNETWORKS_OP_FAILED

Could you describe what changes you've made to sherpa-onnx to support `nnapi?

  1. I built the library using platform android-27 in the build-arm64_v8a.sh script
  2. I changed provider = nnapi in the OfflineTtsModelConfig:
data class OfflineTtsModelConfig(
    var vits: OfflineTtsVitsModelConfig,
    var numThreads: Int = 1,
    var debug: Boolean = false,
    var provider: String = "nnapi",
)

it works fine for me. maybe you can have a try with my build?
https://github.com/rhjdvsgsgks/sherpa-onnx/actions/runs/9963894649

commented

tts-engine-apk-9\sherpa-onnx-1.10.16-arm64-v8a-en-tts-engine-vits-piper-en_GB-alan-medium.apk
crash on redmi note8 android10:
2024-09-09 11:39:22.068 9575-9575 DEBUG pid-9575 A Build fingerprint: 'xiaomi/ginkgo/ginkgo:10/QKQ1.200114.002/20.12.9:user/release-keys'
2024-09-09 11:39:22.068 9575-9575 DEBUG pid-9575 A Revision: '0'
2024-09-09 11:39:22.068 9575-9575 DEBUG pid-9575 A ABI: 'arm64'
2024-09-09 11:39:22.069 9575-9575 DEBUG pid-9575 A Timestamp: 2024-09-09 11:39:22+0800
2024-09-09 11:39:22.069 9575-9575 DEBUG pid-9575 A pid: 9524, tid: 9524, name: onnx.tts.engine >>> com.k2fsa.sherpa.onnx.tts.engine <<<
2024-09-09 11:39:22.069 9575-9575 DEBUG pid-9575 A uid: 10298
2024-09-09 11:39:22.069 9575-9575 DEBUG pid-9575 A signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
2024-09-09 11:39:22.069 9575-9575 DEBUG pid-9575 A Abort message: 'terminating due to uncaught exception of type Ort::Exception: Non-zero status code returned while running Nnapi_17332806132420531993_0 node. Name:'NnapiExecutionProvider_Nnapi_17332806132420531993_0_0' Status Message: model.cc:195 Predict ResultCode: ANEURALNETWORKS_OP_FAILED'
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A x0 0000000000000000 x1 0000000000002534 x2 0000000000000006 x3 0000007fdaec5e40
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A x4 fefefeff43444b48 x5 fefefeff43444b48 x6 fefefeff43444b48 x7 7f7f7f7f7f7f7f7f
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A x8 00000000000000f0 x9 0fd5325a5e91ff31 x10 0000000000000001 x11 0000000000000000
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A x12 fffffff0fffffbdf x13 524f5754454e4c41 x14 0000000000000400 x15 0000000000000000
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A x16 00000073520d28c0 x17 00000073520aea80 x18 0000007353a54000 x19 0000000000002534
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A x20 0000000000002534 x21 00000000ffffffff x22 0000007fdaec5f70 x23 0000007fdaec5fb0
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A x24 0000007fdaec6060 x25 00000000000000df x26 00000073536b1c48 x27 00000073538ca020
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A x28 00000072620e4000 x29 0000007fdaec5ee0
2024-09-09 11:39:22.070 9575-9575 DEBUG pid-9575 A sp 0000007fdaec5e20 lr 00000073520601c4 pc 00000073520601f0
2024-09-09 11:39:22.073 9575-9575 DEBUG pid-9575 A backtrace:
2024-09-09 11:39:22.073 9575-9575 DEBUG pid-9575 A #00 pc 00000000000831f0 /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 3183718d63117d2cc1dc2bd335290f4a)
2024-09-09 11:39:22.073 9575-9575 DEBUG pid-9575 A #1 pc 000000000019bac4 /data/app/com.k2fsa.sherpa.onnx.tts.engine-jil2cpi6ri-uG0n4Uhb4eA==/lib/arm64/libsherpa-onnx-jni.so (BuildId: bc6b29851d049051578ad3025820405859d45a42)

commented

tts-engine-apk-39\sherpa-onnx-1.10.16-arm64-v8a-cs-tts-engine-vits-coqui-cs-cv.apk
crash on redmi note8 android10:

2024-09-09 11:46:57.035 10383-10383 DEBUG pid-10383 A *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2024-09-09 11:46:57.036 10383-10383 DEBUG pid-10383 A Build fingerprint: 'xiaomi/ginkgo/ginkgo:10/QKQ1.200114.002/20.12.9:user/release-keys'
2024-09-09 11:46:57.036 10383-10383 DEBUG pid-10383 A Revision: '0'
2024-09-09 11:46:57.036 10383-10383 DEBUG pid-10383 A ABI: 'arm64'
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A Timestamp: 2024-09-09 11:46:57+0800
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A pid: 10233, tid: 10233, name: onnx.tts.engine >>> com.k2fsa.sherpa.onnx.tts.engine <<<
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A uid: 10299
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A Abort message: 'terminating due to uncaught exception of type Ort::Exception: Non-zero status code returned while running Nnapi_9173412635914989878_0 node. Name:'NnapiExecutionProvider_Nnapi_9173412635914989878_0_0' Status Message: model.cc:195 Predict ResultCode: ANEURALNETWORKS_OP_FAILED'
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A x0 0000000000000000 x1 00000000000027f9 x2 0000000000000006 x3 0000007fdaec5e40
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A x4 fefeff7251ff4344 x5 fefeff7251ff4344 x6 fefeff7251ff4344 x7 7f7f7f7f7f7f7f7f
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A x8 00000000000000f0 x9 0fd5325a5e91ff31 x10 0000000000000001 x11 0000000000000000
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A x12 fffffff0fffffbdf x13 534b524f5754454e x14 0000000000000400 x15 0000000000000000
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A x16 00000073520d28c0 x17 00000073520aea80 x18 0000007353a54000 x19 00000000000027f9
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A x20 00000000000027f9 x21 00000000ffffffff x22 0000007fdaec5f70 x23 0000007fdaec5fb0
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A x24 0000007fdaec6060 x25 00000000000000df x26 00000073536b1bf8 x27 00000073538ca020
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A x28 0000007261165000 x29 0000007fdaec5ee0
2024-09-09 11:46:57.037 10383-10383 DEBUG pid-10383 A sp 0000007fdaec5e20 lr 00000073520601c4 pc 00000073520601f0
2024-09-09 11:46:57.040 10383-10383 DEBUG pid-10383 A backtrace:
2024-09-09 11:46:57.040 10383-10383 DEBUG pid-10383 A #00 pc 00000000000831f0 /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 3183718d63117d2cc1dc2bd335290f4a)
2024-09-09 11:46:57.040 10383-10383 DEBUG pid-10383 A #1 pc 000000000019bac4 /data/app/com.k2fsa.sherpa.onnx.tts.engine-cYBqmnjN1MoDzGENc2AQgg==/lib/arm64/libsherpa-onnx-jni.so (BuildId: bc6b29851d049051578ad3025820405859d45a42)