Skip to content

tensorflow-coral-2022-12-24 via docker

Hi, I am trying to build image for CoralTPU using Docker way (USB version). Plugin version is little dated and would probably need some love 🙂

Building with sh install_with_docker.sh tensorflow-coral-2022-12-24 __random_key__ coraltpu false finish without an error, but running container fail with some errors.

In order to pass usb coral to container, following need to be added to docker-comose.yml:

    volumes:
      - /dev/usb:/dev/usb
    privileged: true
  1. round:
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module 'async'
Require stack:
- /usr/src/app/plugins/tensorflow-coral-2022-12-24/shinobi-tensorflow-coral.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/usr/src/app/plugins/tensorflow-coral-2022-12-24/shinobi-tensorflow-coral.js:15:15)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/src/app/plugins/tensorflow-coral-2022-12-24/shinobi-tensorflow-coral.js'
  ]
}

This is fixed by adding async install to Dockerfile

  1. round:
Error: Cannot find module '../pluginBase.js'
Require stack:
- /usr/src/app/plugins/tensorflow-coral-2022-12-24/shinobi-tensorflow-coral.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/usr/src/app/plugins/tensorflow-coral-2022-12-24/shinobi-tensorflow-coral.js:35:13)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/src/app/plugins/tensorflow-coral-2022-12-24/shinobi-tensorflow-coral.js'
  ]
}

Seems like pluginBase.js is in wrong place, lets try to move it one directory up by altering Dockerfile: ADD https://gitlab.com/Shinobi-Systems/Shinobi/-/raw/master/plugins/pluginBase.js plugins/

shinobi-tensorflow-coral.js checks multiple places, and yield full error to console if not found in first round which is a confusing little.

  1. round

Switching docker build log to plain by add adding export BUILDKIT_PROGRESS=plain show errors regarding pycoral that were not catch by build process:

ERROR: tflite_runtime-2.5.0.post1-cp310-cp310-linux_x86_64.whl is not a supported wheel on this platform. ERROR: pycoral-2.0.0-cp310-cp310-linux_x86_64.whl is not a supported wheel on this platform.

Latest doc show that sudo apt-get install python3-pycoral is prefered way to install it. Also pip method can by found on git: python3 -m pip install --extra-index-url https://google-coral.github.io/py-repo/ pycoral python3 -m pip install --extra-index-url https://google-coral.github.io/py-repo/ tflite-runtime

  1. round

Running container still yield repeating error about restarting python detection. Running example from coral doc yield error about model being build for NUMPY 1.x. Forcing numpy 1.x installation adding pip install numpy==1.26.4 to Dockerfile stoped above error message from occurring.

No more errors at start.

2024-07-28T21:18:20.533Z TensorflowCoral Plugin starting as Client, Host Address : ws://xxx.xxx.xxx.xxx:8080
2024-07-28T21:18:20.567Z TensorflowCoral Plugin started on Port 8082
2024-07-28T21:18:40.575Z TensorflowCoral Plugin Disconnected..
2024-07-28T21:18:43.578Z TensorflowCoral Attempting Reconnect..

Lets try to add key to shinobi config.

  1. round

Key added, but no connection established 😞