Goal : To build a Node.js web server for a training and classification model on the server-side using TensorFlow.js I am trying to do this tutorial to learn TensorFlow.js.
Expected results : Server should run locally on an appropriate port like so.
$ npm run start-server
...
> Running socket on port: 8001
Epoch 1 / 1
eta=0.0 ========================================================================================================>
2432ms 34741us/step - acc=0.429 loss=1.49
Actual results : Server does not run
@MacBook-Pro baseball % npm run start-server
> tfjs-examples-baseball-node@0.2.0 start-server
> node server.js
zsh: illegal hardware instruction npm run start-server
My hardware and software configuration :
- MacBook Pro (13 inches, M1, 2020)
- Chip : Apple M1
- macOS Big Sur version 11.4
- @tensorflow/tfjs-node: ^1.3.2
- Node.js version : v14.17.5
- Xcode 12.5.1 / Build version 12E507
What have I tried ? At this stage, I can't remember the number of Github issues and Stackoverflow question I have read to solve this problem without success.
- Tried using prior versions of @tensorflow/tfjs-node like 1.2.0 and 1.0.0.
- Tried the most recent version of @tensorflow/tfjs-node i.e. 3.8.0
- Checked if Python 2.7.16 and 3.9.6 are installed on my Mac. They are.
- Deleted node_modules and package-lock.json and ran npm install
- Updated Node.js to its most recent version.
- Made sure Xcode is installed.
It seems to be a hardware compatibility issue but I can't figure out the solution. Please note that I am trying to use the Javascript implementation of TensorFlow and not Python.