brain.js without gpu.js?
Hello, I'm trying to use brain.js on a Raspberry Pi Pico (using Kaluma). The only issue is that it won't work without gpu.js. And the Raspberry Pi Pico doesn't have a GPU, as it's a microcontroller. Is there a way to make brain.js run without the gpu.js module?
my effort was to make it so that you didnt need GPU. js if you only had brain.js. if this is the case, I need to adjust something.
I should probably add that I'm not using the NPM package. I actually downloaded the file from the website that's mainly used in web browsers, because I was unable to get the NPM package onto the board.
Thanks for the tip @kdevcse! Your changes fixed the following problem for me, on Arch:
npm ERR! code 7
npm ERR! path /home/crow/Repos/eliza/node_modules/gl
npm ERR! command failed
npm ERR! command sh -c -- prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 2.7.18 found at "/usr/bin/python2.7"
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#<Object>'
npm ERR! gyp ERR! stack at createConfigFile (/home/crow/Repos/eliza/node_modules/node-gyp/lib/configure.js:117:21)
npm ERR! gyp ERR! stack at /home/crow/Repos/eliza/node_modules/node-gyp/lib/configure.js:84:9
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:189:23)
npm ERR! gyp ERR! System Linux 6.0.7-arch1-1
npm ERR! gyp ERR! command "/usr/bin/node" "/home/crow/Repos/eliza/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/crow/Repos/eliza/node_modules/gl
npm ERR! gyp ERR! node -v v19.0.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! Node-gyp failed to build your package.
npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
You might consider opening a PR in this repo (instead of your own), because I'm not sure if the maintainers saw the original one. This seems like a decent solution to a problem that plagued me, across multiple environments.
Thanks for the tip @kdevcse! Your changes fixed the following problem for me, on Arch:
npm ERR! code 7 npm ERR! path /home/crow/Repos/eliza/node_modules/gl npm ERR! command failed npm ERR! command sh -c -- prebuild-install || node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using [email protected] npm ERR! gyp info using [email protected] | linux | x64 npm ERR! gyp info find Python using Python version 2.7.18 found at "/usr/bin/python2.7" npm ERR! gyp ERR! UNCAUGHT EXCEPTION npm ERR! gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#<Object>' npm ERR! gyp ERR! stack at createConfigFile (/home/crow/Repos/eliza/node_modules/node-gyp/lib/configure.js:117:21) npm ERR! gyp ERR! stack at /home/crow/Repos/eliza/node_modules/node-gyp/lib/configure.js:84:9 npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:189:23) npm ERR! gyp ERR! System Linux 6.0.7-arch1-1 npm ERR! gyp ERR! command "/usr/bin/node" "/home/crow/Repos/eliza/node_modules/.bin/node-gyp" "rebuild" npm ERR! gyp ERR! cwd /home/crow/Repos/eliza/node_modules/gl npm ERR! gyp ERR! node -v v19.0.1 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! Node-gyp failed to build your package. npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.You might consider opening a PR in this repo (instead of your own), because I'm not sure if the maintainers saw the original one. This seems like a decent solution to a problem that plagued me, across multiple environments.
Done!
What worked for me was yarn add gpu.js (I guess you could use npm install gpu.js too)
my effort was to make it so that you didnt need GPU. js if you only had brain.js. if this is the case, I need to adjust something.
That's not how it works currently. If you don't install gpu.js then brain.js won't work, even on something that isn't GPU accelerated like recurrent.LSTM().