VeriSilicon / tflite-vx-delegate

Tensorflow Lite external delegate based on TIM-VX
MIT License
42 stars 23 forks source link

benchmark_model failed with: Create tensor fail! #71

Closed tonysung closed 2 years ago

tonysung commented 2 years ago

Run TFLite's benchmark_model with libvx_delegate result in multiple "Create tensor fail!" and segmentation fault.

Tried these two models from https://www.tensorflow.org/lite/guide/hosted_models and the results are the same:

Example output:

$ adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/benchmark_model --graph=/data/local/tmp/mobilenet_v2_1.0_224_quant.tflite --external_delegate_path=/data/local/tmp/libvx_delegate.so

STARTING!
Duplicate flags: num_threads
Log parameter values verbosely: [0]
Graph: [/data/local/tmp/mobilenet_v2_1.0_224_quant.tflite]
External delegate path: [/data/local/tmp/libvx_delegate.so]
Loaded model /data/local/tmp/mobilenet_v2_1.0_224_quant.tflite
INFO: Initialized TensorFlow Lite runtime.
Vx delegate: allowed_cache_mode set to 0.
Vx delegate: allowed_builtin_code set to 0.
Vx delegate: error_during_init set to 0.
Vx delegate: error_during_prepare set to 0.
Vx delegate: error_during_invoke set to 0.
EXTERNAL delegate created.
INFO: Initialize supported_builtins
INFO: Replacing 65 node(s) with delegate (Vx Delegate) node, yielding 1 partitions.
INFO: vx_delegate Delegate::Init
INFO: Initialize supported_builtins
INFO: Delegate::Prepare node: 0xac9111e0
Explicitly applied EXTERNAL delegate, and the model graph will be completely executed by the delegate.
The input model file size (MB): 3.57776
Initialized session in 33.502ms.
Running benchmark for at least 1 iterations and at least 0.5 seconds but terminate if exceeding 150 seconds.
INFO: Delegate::Invoke node: 0xac9111e0
E [/ext/tim-vx/src/tim/vx/tensor.cc:Init:221]Create tensor fail!
E [/ext/tim-vx/src/tim/vx/tensor.cc:Init:221]Create tensor fail!
E [/ext/tim-vx/src/tim/vx/tensor.cc:Init:221]Create tensor fail!
E [/ext/tim-vx/src/tim/vx/tensor.cc:Init:221]Create tensor fail!
E [/ext/tim-vx/src/tim/vx/tensor.cc:Init:221]Create tensor fail!
INFO: Creating Conv2d op
Segmentation fault
sunshinemyson commented 2 years ago

Hi Tonysung,

Please share your dmesg log and Android logcat content. I think your driver stack not loaded properly.

Thanks

tonysung commented 2 years ago

Here you go: dmesg-before-run.txt dmesg-after-run.txt logcat-during-run.txt

Please note that the Segmentation fault happens after the Create tensor fail! error message.

tonysung commented 2 years ago

Are these information sufficient?

sunshinemyson commented 2 years ago

@tonysung ,

I checked it internally, your driver out of date, you can try it with the guideline by baidu: https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/docs/demo_guides/verisilicon_timvx.md

Thanks