sherpa-onnx icon indicating copy to clipboard operation
sherpa-onnx copied to clipboard

How can I use my own models on Android?

Open elnursamedzade opened this issue 1 year ago • 14 comments

Hello. I have TTS models that I trained with Piper. How can I use this as a TTS engine?

I placed my own TTS model in the android/SherpaOnnxTtsEngine/app/src/main/assets directory, I copied the previously created library files to the jniLibs/arm64-v8a directory. When I run the APK on the phone, the application crashes. What could be the problem?

elnursamedzade avatar Mar 26 '24 16:03 elnursamedzade

it could be lots of things, if you post the log with the errors it will be easier to say. take a look on this issue i opened an solved yesterday: https://github.com/k2-fsa/sherpa-onnx/issues/701

carapatounfor avatar Mar 26 '24 22:03 carapatounfor

it could be lots of things, if you post the log with the errors it will be easier to say. take a look on this issue i opened an solved yesterday: https://github.com/k2-fsa/sherpa-onnx/issues/701

Yes, you are right.

Please give us error logs. Otherwise, we don't know what bad things have happened.

csukuangfj avatar Mar 26 '24 22:03 csukuangfj

Hello. There is no error output. The APK is created correctly and there is no apk crashing problem with the published models. However, when I use my own model, the application crashes on my device. How do I make my own tokens.txt file? Maybe that's why it collapsed. I have not created tokens yet

27 Mar 2024 Çar 02:42 tarihinde Fangjun Kuang @.***> şunu yazdı:

it could be lots of things, if you post the log with the errors it will be easier to say. take a look on this issue i opened an solved yesterday: #701 https://github.com/k2-fsa/sherpa-onnx/issues/701

Yes, you are right.

Please give us error logs. Otherwise, we don't know what bad things have happened.

— Reply to this email directly, view it on GitHub https://github.com/k2-fsa/sherpa-onnx/issues/706#issuecomment-2021591655, or unsubscribe https://github.com/notifications/unsubscribe-auth/APEI6Q66OHTE6P74RMK6SLLY2H2VFAVCNFSM6AAAAABFJI4WEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRRGU4TCNRVGU . You are receiving this because you authored the thread.Message ID: @.***>

elnursamedzade avatar Mar 27 '24 15:03 elnursamedzade

please use logcat to get the logs.

csukuangfj avatar Mar 27 '24 22:03 csukuangfj

Please download any piper model provided by us, unzip it, and you will find the code for adding meta data and for generating tokens.txt

csukuangfj avatar Mar 27 '24 22:03 csukuangfj

I implemented it exactly and got the following error in the python code:

ImportError: cannot import name 'Lang' from 'iso639' (unknown location)

elnursamedzade avatar Mar 28 '24 01:03 elnursamedzade

Please see https://github.com/k2-fsa/sherpa-onnx/blob/a042f440767ef6bd78b696db68318e13da852aad/scripts/apk/generate-tts-apk-script.py#L9-L10

csukuangfj avatar Mar 28 '24 01:03 csukuangfj

By the way, we have a dedicated page describing how to convert piper models to sherpa-onnx.

Please see https://k2-fsa.github.io/sherpa/onnx/tts/piper.html

csukuangfj avatar Mar 28 '24 01:03 csukuangfj

If you know the language code, you don't need to use iso639.

csukuangfj avatar Mar 28 '24 01:03 csukuangfj

Problem solved. Thank you. This issue can now be closed. The generated apk sometimes becomes unresponsive and the double-talk errors mentioned in #701 persist. This error is also present in apks in your repository. For example sherpa_onnx_1_9_12_arm64_v8a_tr_tts_engine_vits_piper_tr_TR_fahrettin.apk,. Maybe a new issue can be opened for this.

elnursamedzade avatar Mar 28 '24 03:03 elnursamedzade

The generated apk sometimes becomes unresponsive and the double-talk errors mentioned in https://github.com/k2-fsa/sherpa-onnx/issues/701 persist

Could you describe what phone you are using? What type of CPU does your phone have?

Also, would you mind providing a video to show the issue?

I have never encountered such an issue before.

csukuangfj avatar Mar 28 '24 03:03 csukuangfj

Since I am visually impaired, taking video may be a problem. The phone I use is Unihertz Titan Slim.

I also have a Blackberry Keyone device. I will try it on that device and write the result here.

elnursamedzade avatar Mar 28 '24 11:03 elnursamedzade

The phone I use is Unihertz Titan Slim.

This phone has 4 Cortex A73 CPUs and 4 Cortex A53 CPUs. I don't know which 2 CPUs are used for the TTS engine. The TTS engine uses 2 threads by default.

If it uses A73, then there shouldn't be any issues.

csukuangfj avatar Mar 28 '24 13:03 csukuangfj

I can not understand. The apk I created works with the interface on the device, that is, when I write something in the text box and test it, it speaks, but it does not work with talkback or other screen readers, it remains silent.

elnursamedzade avatar Mar 28 '24 14:03 elnursamedzade