Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EdgeTpuDelegateForCustomOp failed to prepare #16

Closed
petewarden opened this issue Apr 27, 2020 · 23 comments
Closed

EdgeTpuDelegateForCustomOp failed to prepare #16

petewarden opened this issue Apr 27, 2020 · 23 comments

Comments

@petewarden
Copy link

When following the guide at https://coral.ai/docs/dev-board/get-started#6-run-a-model-using-the-tensorflow-lite-api I see the following error instead of the expected classification results:

mendel@red-bunny:~/tflite/python/examples/classification$ python3 classify_image.py \
> --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
> --labels models/inat_bird_labels.txt \
> --input images/parrot.jpg
Traceback (most recent call last):
  File "classify_image.py", line 122, in <module>
    main()
  File "classify_image.py", line 100, in main
    interpreter.allocate_tensors()
  File "/home/mendel/.local/lib/python3.7/site-packages/tflite_runtime/interpreter.py", line 242, in allocate_tensors
    return self._interpreter.AllocateTensors()
  File "/home/mendel/.local/lib/python3.7/site-packages/tflite_runtime/interpreter_wrapper.py", line 115, in AllocateTensors
    return _interpreter_wrapper.InterpreterWrapper_AllocateTensors(self)
RuntimeError: Internal: Unsupported data type: 0Node number 1 (EdgeTpuDelegateForCustomOp) failed to prepare.
@Namburger
Copy link

@petewarden
Can you share the outputs of these commands:

$ dpkg -l | grep edgetpu
$ python3 -c 'print(__import__("tflite_runtime").__version__)'

@petewarden
Copy link
Author

Sure, thanks!

$ dpkg -l | grep edgetpu
ii  edgetpudemo                          3-1                         all          Edge TPU demo script
ii  libedgetpu1-std:arm64                12-1                        arm64        Support library for Edge TPU
ii  python3-edgetpu                      12.1-1                      arm64        Edge TPU Python API
ii  python3-edgetpuvision                6-1                         arm64        EdgeTPU camera API
$ python3 -c 'print(__import__("tflite_runtime").__version__)'
2.1.0.post1

@Namburger
Copy link

@petewarden
So the issue is that you got mismatching version of libedgetpu1-std:arm64 and tflite_runtime.
The fix for this should be as easy as an apt update and reinstall your package:

$ sudo apt update
$ sudo apt upgrade libedgetpu1-std

Here is the correct version for reference:

mendel@purple-orange:~$ dpkg -l | grep edgetpu
ii  edgetpudemo                          3-1                                 all          Edge TPU demo script
ii  libedgetpu1-max:arm64                14.0                                arm64        Support library for Edge TPU
ii  python3-edgetpu                      14.0                                arm64        Edge TPU Python API
ii  python3-edgetpuvision                6-1                                 arm64        EdgeTPU camera API

@petewarden
Copy link
Author

Awesome, thanks, that works! Closing.

@mattheys
Copy link

For windows users trying to run the demo, download 2.14.0 not 2.14.1 from here https://dl.google.com/coral/edgetpu_api/edgetpu_runtime_20200331.zip

@Namburger
Copy link

@mattheys are you having issues with 2.14.1? They should be the same library with 2.14.1 added window supports for pcie

@mattheys
Copy link

Yes, I got the following error with 2.14.1, downgrading to 2.14.0 worked fine with the edgetpu models here https://github.com/google-coral/edgetpu/raw/master/test_data.

python classify_image.py --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels models/inat_bird_labels.txt --input images/parrot.jpg

Traceback (most recent call last):
  File "classify_image.py", line 122, in <module>
    main()
  File "classify_image.py", line 100, in main
    interpreter.allocate_tensors()
  File "C:\Users\<userid>\AppData\Local\Programs\Python\Python37\lib\site-packages\tflite_runtime\interpreter.py", line 243, in allocate_tensors
    return self._interpreter.AllocateTensors()
  File "C:\Users\<userid>\AppData\Local\Programs\Python\Python37\lib\site-packages\tflite_runtime\tensorflow_wrap_interpreter_wrapper.py", line 110, in AllocateTensors
    return _tensorflow_wrap_interpreter_wrapper.InterpreterWrapper_AllocateTensors(self)
RuntimeError: Internal: Unsupported data type in custom op handler: 0Node number 1 (EdgeTpuDelegateForCustomOp) failed to prepare.

Sorry do you want me to open a new issue?

@Namburger
Copy link

@mattheys are you using a pcie module or a USB Accelerator?
Let me confirm with our team to make sure that this isn't expected first, thanks for reporting

@mattheys
Copy link

It's a USB Accelerator

@Namburger
Copy link

@mattheys as it turned out, we uploaded the wrong zip file lol
If you redownload it again and reinstall it'll works :)

@musekeskin
Copy link

Hi,
I have a similar problem.
mendel@xenial-yarn:~/coral/pycoral$ python3 examples/classify_image.py \

--model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite
--labels test_data/inat_bird_labels.txt
--input test_data/parrot.jpg
Traceback (most recent call last):
File "examples/classify_image.py", line 82, in
main()
File "examples/classify_image.py", line 60, in main
interpreter.allocate_tensors()
File "/home/mendel/.local/lib/python3.7/site-packages/tflite_runtime/interpreter.py", line 242, in allocate_tensors
return self._interpreter.AllocateTensors()
File "/home/mendel/.local/lib/python3.7/site-packages/tflite_runtime/interpreter_wrapper.py", line 115, in AllocateTensors
return _interpreter_wrapper.InterpreterWrapper_AllocateTensors(self)
RuntimeError: Internal: Unsupported data type in custom op handler: 0Node number 1 (EdgeTpuDelegateForCustomOp) failed to prepare.

mendel@xenial-yarn:~/coral/pycoral$ dpkg -l | grep edgetpu
ii edgetpudemo 3-1 all Edge TPU demo script
ii libedgetpu1-std:arm64 15.0 arm64 Support library for Edge TPU
ii python3-edgetpuvision 7-1 arm64 EdgeTPU camera API

@Namburger
Copy link

Namburger commented Dec 3, 2020

@musekeskin can you check your tflite_runtime version also? It should be 2.5.0 at this time!

@musekeskin
Copy link

mendel@xenial-yarn:~$ python3 -c 'print(import("tflite_runtime").version)'
2.1.0

@Namburger
Copy link

Yelp, please upgrade the package.
https://www.tensorflow.org/lite/guide/python

@musekeskin
Copy link

it is need to be version 2.15 or is it 2.5?
mendel@xenial-yarn:~$ pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_armv7l.whl

tflite_runtime-2.5.0-cp37-cp37m-linux_armv7l.whl is not a supported wheel on this platform.

@Namburger
Copy link

@musekeskin sorry 2.5 is what I meant.

is not a supported wheel on this platform.

is a very self explanatory message

Are you trying to run this on the Dev Board? If so it should be using the arm64 wheel as opposed to arm32.

@musekeskin
Copy link

yes dev board.
mendel@xenial-yarn:~$ pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Collecting tflite-runtime==2.5.0 from https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff9e2bd6a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff9e6eccc0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff9e6eceb8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff9e6ece48>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff9e6ecef0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff9ef41128>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

@Namburger
Copy link

@musekeskin okay, now this is kind of an internet issue, you can try wget it first and then install?

@musekeskin
Copy link

I downloaded the file somehow. But now I am getting such an error;

mendel@xenial-yarn:$ python3 --version
Python 3.7.3
mendel@xenial-yarn:
$ ls
coral labels.txt
dog.jpg mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite
edgetpu-2.14.1-py3-none-any.whl pycoral-1.0.0-cp38-cp38-linux_x86_64.whl
google-coral pycoral.git
İndirilenler tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
mendel@xenial-yarn:~$ pip3 install tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Processing ./tflite_runtime-2.5.0-cp37-cp37m-linux_aarch64.whl
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 143, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 338, in run
resolver.resolve(requirement_set)
File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 102, in resolve
self._resolve_one(requirement_set, req)
File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 259, in _resolve_one
dist = abstract_dist.dist(self.finder)
File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 77, in dist
self.req.source_dir))[0]
IndexError: list index out of range

@musekeskin
Copy link

After deleting the old installed version I was able to install the new version. Worked. Thanks !

@luckywangchenxi
Copy link

Hello,
I have a similar problem.
mendel@neat-kid:~/coral/pycoral$ python3 examples/classify_image.py \

--model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite
--labels test_data/inat_bird_labels.txt
--input test_data/parrot.jpg
Traceback (most recent call last):
File "examples/classify_image.py", line 82, in
main()
File "examples/classify_image.py", line 60, in main
interpreter.allocate_tensors()
File "/home/mendel/.local/lib/python3.7/site-packages/tflite_runtime/interpreter.py", line 242, in allocate_tensors
return self._interpreter.AllocateTensors()
File "/home/mendel/.local/lib/python3.7/site-packages/tflite_runtime/interpreter_wrapper.py", line 115, in AllocateTensors
return _interpreter_wrapper.InterpreterWrapper_AllocateTensors(self)
RuntimeError: Internal: Unsupported data type in custom op handler: 1081772464Node number 1 (EdgeTpuDelegateForCustomOp) failed to prepare.

mendel@purple-orange:~$ dpkg -l | grep edgetpu
ii edgetpudemo 3-1 all Edge TPU demo script
ii libedgetpu1-max:arm64 14.1 arm64 Support library for Edge TPU
ii python3-edgetpu 14.1 arm64 Edge TPU Python API
ii python3-edgetpuvision 6-1 arm64 EdgeTPU camera API

$ python3 -c 'print(import("tflite_runtime").version)'
2.5.0.post1

@hjonnala
Copy link

hjonnala commented Sep 4, 2021

@wangchenxi777
please try
python3 -c 'from pycoral.utils.edgetpu import get_runtime_version; print(get_runtime_version())'
if the output is not same below
BuildLabel(COMPILER=6.3.0 20170516,DATE=redacted,TIME=redacted), RuntimeVersion(14)

to upgrade the edgetpu runtime please follow these instructions https://coral.ai/docs/dev-board/reflash/#update-your-board-with-apt-get

@luckywangchenxi
Copy link

ok thankyou
now I will try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants