Closed Zak-SA closed 3 years ago
just a clarification to my question, the conversion works fine and I can inference using the TFlite model from python, but my question is about the necessary changes for Android code including gradle.build or fastspeech2.java or any other changes to android. Thanks
@dathudeptrai I need your help good old friend
@Zak-SA did you try tflite nightly in android ?
@dathudeptrai yes, I already have the fastspeech2 tflite working on android but only when converted using tf-nighlty version 2.4.0and not the new versions, tf-nightly 2.4.0 is no longer available or supported , so I was wondering what changes should apply on the android example to make it work with the new tf-nightly. Thanks
@dathudeptrai another note, the android works if the runtime used for conversion is 1.14.0 and didn't work when I used runtime 2.3.0
@Zak-SA I do not know but you just need to change the version of tflite in the android example and it's enough. If it doesn't work, there should be a bug in tflite-nightly then you need ask tflite authors for this bug :D.
@dathudeptrai do you mean in app build gradle dependencies? as far as I know that in android you just chose 0.0.0 and you can't pin specific version but android get updates everyday. in android/app/build.gradle from line 36 to 38
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly' implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly' implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly'
maybe it's something related to input and output? I'll try different version of tfnightly and see if it works.
@Zak-SA can you follow (https://www.tensorflow.org/lite/guide/android#use_the_tensorflow_lite_aar_from_jcenter). use org.tensorflow:tensorflow-lite-support:0.1.0
and org.tensorflow:tensorflow-lite:0.0.0-nightly-SNAPSHOT
and org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly-SNAPSHOT
@dathudeptrai I will try and let you know, I didn't change what in the example because it worked before
@dathudeptrai I changed the dependencies and still crashes, I get java.lang.NullPointerException: Attempt to invoke virtual method 'void org.tensorflow.lite.Interpreter.resizeInput(int, int[])' on a null object reference
the only difference between the working tflite model and the one causing the error I am getting is the tf-nightly and runtime used for conversion, the new tf-nightly uses 2.3.0 while the one works uses 1.14.0
@Zak-SA I get the same error: Attempt to invoke virtual method 'void org.tensorflow.lite.Interpreter.resizeInput(int, int[])' on a null object reference
But the error is a consequence of this error:
W/System.err: java.lang.IllegalArgumentException: Contents of /data/user/0/com.tensorspeech.tensorflowtts/files/fastspeech2_quant.tflite does not encode a valid TensorFlow Lite model: Mmap of '/data/user/0/com.tensorspeech.tensorflowtts/files/fastspeech2_quant.tflite' failed.
The model is not a valid Flatbuffer file
at org.tensorflow.lite.NativeInterpreterWrapper.createModel(Native Method)
W/System.err: at org.tensorflow.lite.NativeInterpreterWrapper.
I didn't change anything on the project and just imported it. It worked for me a few months ago, now it doesnt.
@Urteilsbilder what version of tensorflow did you use to convert the model to tflite? Also I beleive that tensorflow dependencies migrated from jcenter and will no longer be updated from there.
@Zak-SA I did not convert anything, already with the Tflite models that came with the project the errors came.
@Urteilsbilder that's weird, if I use tf-nightly 2.4.0 to convert the models it works fine. Only when I use newer version of tensorflow I get this issue .
On some devices it works and on others I get this error: A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xfffffff4 in tid 6679 (init-21), pid 6654 (h.tensorflowtts)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Hi, any help to use tf-nightly 2.6.0.dev20210426 or even 2.5.0 converting Fastspeech2 in android? what changes we should apply? I tried the existing android code and it didn;t work, only if I use tf-nightly 2.4.0.dev202002301 but this version can not be found anymore and will stop working on July 2021. mbmelgan worked fine using the new version of tf-nightly but not fastspeech2
Thanks