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

Failed to load delegate from libedgetpu.so.1 & Inappropriate ioctl for device with M.2 Accelerator A+E key #152

Open
PinxuanHuang opened this issue Oct 18, 2024 · 1 comment
Labels
comp:model Model related isssues Hardware:M.2 Accelerator A+E Coral M.2 Accelerator A+E key issues subtype:ubuntu/linux Ubuntu/Linux Build/installation issues type:bug Bug type:performance Performance issues

Comments

@PinxuanHuang
Copy link

PinxuanHuang commented Oct 18, 2024

Description

I'm using the M.2 Accelerator A + E to do some PoC.

Currently I open the Kernel Config to build the necessary kernel module (coral tpu driver) and follow the official example to verify. I can see /dev/apex_0 after I insmod gaket & apex, but when I run the example 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 in the container (debian:10) it shows this error and also Inappropriate ioctl for device error.

image

image

image

The error also appear in Frigate NVR. It's weird that it shows no TPU device was detected, but there's /dev/apex_0 and also libedgetpu.so.1.0 under /usr/lib/aarch-linux-gnu directory.

image

image

image

What do I need to do for fixing it?

image

image

CONFIG_STAGING=y
CONFIG_STAGING_GASKET_FRAMEWORK=m
CONFIG_STAGING_APEX_DRIVER=m
  • kernel version
    • 4.19.294
  • Driver version
    • apex 1.0
    • gasket 1.1.2
  • os
    • linux

Thanks.

reference
[1] https://coral.ai/docs/m2/get-started/#requirements

[2] https://coral.ai/docs/notes/build-coral/#required-components

[3] https://coral.googlesource.com/linux-imx/+/refs/heads/dkms/drivers/staging/gasket/

[4] https://github.com/google-coral/libedgetpu#building

Click to expand!

Issue Type

Bug

Operating System

Linux

Coral Device

M.2 Accelerator A+E

Other Devices

No response

Programming Language

Python 3.7

Relevant Log Output

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

I tflite/edgetpu_manager_direct.cc:453] No matching device is already opened for shared ownership.
I driver/usb/local_usb_device.cc:944] EnumerateDevices: vendor:0x1a6e, product:0x89a
I driver/usb/local_usb_device.cc:979] EnumerateDevices: checking bus[2] port[0]
I driver/usb/local_usb_device.cc:979] EnumerateDevices: checking bus[1] port[2]
I driver/usb/local_usb_device.cc:979] EnumerateDevices: checking bus[1] port[0]
I driver/usb/local_usb_device.cc:944] EnumerateDevices: vendor:0x18d1, product:0x9302
I driver/usb/local_usb_device.cc:979] EnumerateDevices: checking bus[2] port[0]
I driver/usb/local_usb_device.cc:979] EnumerateDevices: checking bus[1] port[2]
I driver/usb/local_usb_device.cc:979] EnumerateDevices: checking bus[1] port[0]
I tflite/edgetpu_context_direct.cc:106] USB always DFU: False (default)
I tflite/edgetpu_context_direct.cc:128] USB bulk-in queue capacity: default
I tflite/edgetpu_context_direct.cc:67] Performance expectation: Max (default)
I ./driver/mmio/host_queue.h:266] Starting in normal mode
I driver/kernel/kernel_registers.cc:83] Opening /dev/apex_0. read_only=0
I driver/kernel/kernel_registers.cc:97] mmap_offset=0x0000000000040000, mmap_size=4096
I tflite/edgetpu_context_direct.cc:401] Failed to open device [Apex (PCIe)] at [/dev/apex_0]: Internal: Could not mmap: Operation not permitted
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
    delegate = Delegate(library, options)
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
    raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "examples/classify_image.py", line 123, in <module>
    main()
  File "examples/classify_image.py", line 73, in main
    interpreter = make_interpreter(*args.model.split('@'))
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 163, in load_delegate
    library, str(e)))
ValueError: Failed to load delegate from libedgetpu.so.1
@google-coral-bot google-coral-bot bot added comp:model Model related isssues Hardware:M.2 Accelerator A+E Coral M.2 Accelerator A+E key issues subtype:ubuntu/linux Ubuntu/Linux Build/installation issues type:bug Bug type:performance Performance issues labels Oct 18, 2024
@mdvthu
Copy link

mdvthu commented Oct 31, 2024

So close to returning my Accelerator because of this bug: Raspberry Pi 5 with both Debian (Raspbian) and Ubuntu 24.04 LTS. Has anyone made any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:model Model related isssues Hardware:M.2 Accelerator A+E Coral M.2 Accelerator A+E key issues subtype:ubuntu/linux Ubuntu/Linux Build/installation issues type:bug Bug type:performance Performance issues
Projects
None yet
Development

No branches or pull requests

2 participants