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

Which sha256 number for Tflite and libedgetpu #600

Closed
timocafe opened this issue May 30, 2022 · 3 comments
Closed

Which sha256 number for Tflite and libedgetpu #600

timocafe opened this issue May 30, 2022 · 3 comments
Assignees
Labels
comp:model Model related isssues Hardware:Dev Board Coral Dev Board issues subtype:macOS macOS Build/installation issues type:support Support question or issue

Comments

@timocafe
Copy link

timocafe commented May 30, 2022

Description

Hello,

[Short] I have some issue with bazel specially for the sha number I should indicate in the WORKSPACE. With my current number my binary crash into InterpreterBuilder. Similar problem here.

[Long] my python code works with 8/16 bits quantize model. Due to performance, I wanted to test the cpp version. To obtain a binary, I have crossed compile with bazel (it works for hello world), however the binary crashes in libedgetpu. I build my bazel on this example.

Finally to still have something, I did a local compilation of tflite-sha d855adfc5a0195788bf5f92c3c7352e638aa1109, it works but the release is "bit" old (jan. 2020, and it does not support 16bit quantization.

I provide a simple hello word bazel/docker. My dev board is also built before april 2019, and it has been flash mendel 5.3. I think several SHA numbers are not up to date. Or I may did a mistake with my bazel, I am not familiar with this packet manager.

bugfolder.zip

make DOCKER_TARGETS=qinait DOCKER_CPUS=aarch64 docker-shell
make
./bug whatever8b.tflite

I can not provide my model due to IP.

Thank you very much

Issue Type

Support

Operating System

Mac OS

Coral Device

Dev Board

Other Devices

No response

Programming Language

C++

Relevant Log Output

// the log comes from the hello word code I provide in the description.

mendel@tuned-jet:~$ ./bug model/model_quantize_8b.tflite 
tpu: 0
type: Apex (PCIe)
path: /dev/apex_0
Building model: model/model_quantize_8b.tflite
Segmentation fault
@google-coral-bot google-coral-bot bot added comp:model Model related isssues Hardware:Dev Board Coral Dev Board issues subtype:macOS macOS Build/installation issues type:support Support question or issue labels May 30, 2022
@hjonnala
Copy link
Contributor

hjonnala commented Jun 2, 2022

Hello @timocafe

Please try the below steps:
STEP1:

  1. git clone --recurse-submodules https://github.com/google-coral/libcoral
  2. add bug.cpp file to examples folder: https://github.com/google-coral/libcoral/tree/master/coral/examples
  3. add the foolowing code to build file: https://github.com/google-coral/libcoral/blob/master/coral/examples/BUILD
cc_binary(
    name = "bug",
    srcs = ["bug.cpp"],
    deps = [
        "@libedgetpu//tflite/public:oss_edgetpu_direct_all",
        "@org_tensorflow//tensorflow/lite:builtin_op_data",
        "@org_tensorflow//tensorflow/lite:framework",
        "@org_tensorflow//tensorflow/lite/kernels:builtin_ops",
    ],
    linkopts = ["-pthread","-lstdc++fs"],
)
  1. add the below line at: https://github.com/google-coral/libcoral/blob/master/Makefile#L102
    //coral/examples:bug \
  2. add the below line at: https://github.com/google-coral/libcoral/blob/master/Makefile#L109
    $(BAZEL_OUT_DIR)/coral/examples/bug \

STEP2:

cd libcoral
make docker-shell
make CPU=aarch64 examples

STEP3: (copy the binary to dev board)
mdt push ../../libcoral/out/aarch64/examples/bug

STEP4: (On Dev Board)

mendel@arid-calf:~$ sudo chmod 770 bug
mendel@arid-calf:~$ ./bug efficientdet-lite-salad_edgetpu.tflite 
tpu: 0
type: Apex (PCIe)
path: /dev/apex_0
Building model: efficientdet-lite-salad_edgetpu.tflite
Built interpreter success!
Tensors Allocated!
mendel@arid-calf:~$ 

Here is the pre complied binary: https://github.com/hjonnala/snippets/blob/main/edgetpu_600/bug

@timocafe
Copy link
Author

timocafe commented Jun 3, 2022

I succeed the cross compilation and it run, thank you very much. Just a last question currently on the dock env the GCC version is gcc 6.3, on the coral it is 8.3. It is bit painful for the c++17 and std::filesystem which is experimental for GCC 6.3. Is it possible to modify the WORKSPACE and update to 8.3 ? Cheers.

@timocafe timocafe closed this as completed Jun 3, 2022
@google-coral-bot
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

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:Dev Board Coral Dev Board issues subtype:macOS macOS Build/installation issues type:support Support question or issue
Projects
None yet
Development

No branches or pull requests

2 participants