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
Unsupported system error when installing on M1 / Apple Silicon #4514
Comments
@nickplee thank you for reporting this, can you help to test it out following the instruction of custom TF build @yhwang any suggestions on this? thanks. |
since the tfjs-node@2.8.3 is using tensorflow shared libs v1.15.0, I think it's better to build the dependent shared libs by using the link @pyu10055 posted above. However, the tricky part would be tweaking the tensorflow to build on darwin arm64. It's okay by using ubuntu with arm64 to build tensorflow shared libs. But I am not sure about darwin with arm64. For the tensorflow apple provides, you can verify whether you can find all files in this tarball from the binaries that apple provides. If yes, you can just put them under |
@pyu10055 a side question: any idea of supporting more platforms and architectures officially? |
I actually already tried subbing in the Apple library and recompiling the binding. Once you install it, it includes the dylib as well as the headers. I was hopeful, but ran in to two issues:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you. |
Perhaps with tensorflow/tensorflow#45404 this is more feasible? Has anyone been able to get tfjs-node to work on an M1 device? We're extremely interested in this as well. If anyone has been able to get it working, we would very, very much appreciate some pointers :) |
Closing as stale. Please @mention us if this needs more attention. |
Can this be reopened or someone point us in the direction of where we should go to help? Support for the new M1 macs is essential for any applications running edge TF models. |
@patrickhulce reopened |
Thank you @rthadur! Is there anything that we can help with? My current understanding based on #4514 (comment) is that there a few patches (possibly that @nickplee already has written?) to work with the 2.4 API or attempt to rebuild 2.3 using the methods described in tensorflow/tensorflow#45404. My M1 rig is arriving this week, so I'll be able to provide more hands-on assistance then if I know where I can be helpful :) |
Gentle ping for @pyu10055 |
Just chiming in - I wasn't able to get tfjs/node working on my M1. The moment I import '@tensorflow/tfjs-node', node just quits out with no error message. |
Any update on this issue by any chance? Experiencing the exact same dylib error. |
I've just successfully built and ran my models with tfjs-node 3.5.0 with TensorFlow 2.5.0-rc1 on my M1 Macbook Air. From what I could see, the yet-to-be released TF 2.5.0 is where Apple Silicon is supported, but pre-release 2.5.0-rc1 is already fully usable. Caveat: I didn't keep exact track of all the steps, this was written in "hindsight" so I maybe I'm missing something.
That's it. You should be able to import/require the Tensorflow JS modules and train/predict without issues. I'm still testing this, but so far so good. Training speed is ~5x or faster compared my 2015 Intel i7 Macbook Air and 2-3x compared to a 16 core 4GHz Intel Xeon E5 server. You can install the @tensorflow/tfjs-node directory by copying it around, repeating the steps or just doing this in a global context ( |
Thank you @rodrigolive , @patrickhulce @nickplee can you please confirm if this is resolved on M1 chip with latest release. |
The issue as described is not resolved with @rodrigolive's workaround. Manually hacking tfjs/tfjs-node/scripts/install.js Lines 87 to 103 in b785953
I might be able to take some time next weekend to give a stab at it if no one else has the bandwidth to do so, but closing would be unfortunate as there's still work to be done in this repo. |
Note that I've used a release candidate version. I'd say we still need to wait for TensorFlow 2.5.x to be released, that would be the first GA version to fully support Apple Silicon. Then, yes, we can publish the binary to the storage location and update the install scripts to handle I'm also not sure about the build flags that should be used,
Source: tensorflow/tensorflow#45404 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you. |
These are the steps that worked for me to install unreleased M1-supported version (as I just can't wait for release, need to work on M1 now). Copy the patch from below to yarn add -D patch-package @mapbox/node-pre-gyp
yarn add @tensorflow/tfjs-node --ignore-scripts
yarn patch-package
cd node_modules/@tensorflow/tfjs-node
yarn add -D @mapbox/node-pre-gyp
node scripts/install.js
The patch is basically applying this PR on top of last released version: https://github.com/tensorflow/tfjs/pull/5899/files |
@kirillgroshkov Or you know you could just point to the |
@pyu10055 Is there any chance we could get an ETA on a release for this tho? Although pointing to the branch directly works fine, I'd love to submit some PRs to some dependencies that use tfjs, and it's highly unlikely PRs will get approved when pointing to a branch. |
We are expecting to release a new version next week. Thanks for the
patience.
…On Fri, Dec 3, 2021 at 6:12 PM Charlie Fish ***@***.***> wrote:
@pyu10055 <https://github.com/pyu10055> Is there any chance we could get
an ETA on a release for this tho? Although pointing to the branch directly
works fine, I'd love to submit some PRs to some dependencies that use tfjs,
and it's highly unlikely PRs will get approved when pointing to a branch.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4514 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAA7MTDWNA26H445KS6K6TUPF2HTANCNFSM4V3HOZSQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Did it work for you, to point to a github branch? I just checked - the source code is in TypeScript, which needs to be compiled into |
@kirillgroshkov Ahh, sorry. Pointing it to The fact that it's in TypeScript doesn't matter. It'll get built upon install. |
any update? |
Latest release works :) |
Im running the new version on my M1. Locally it works fine but when using docker, it runs into this issue:
I think the the PR enabled the function for cpu-darwin-arm64 but not for cpu-linux-arm64. Does anyone know if support for linux/arm64 is planned? |
Same issue with @GitHelge, would be great if there's a resolution for docker! |
@pyu10055 Do you have any thoughts about this on Docker? |
so far no luck with monterey. tried . tfjs-node 3.15,3.5 & node 14,16 & build my own tensorflow 2.5 & used posted tensorflow 2.7 builds too. But the main reason i am posting is to ask for any idea or even it would be possible to use the instance of Tensorflow on Conda Env. with Metal Plugin (which i already succeded to run GPU based Tensorflow runs) . I think somehow configuring tfjs-node wrapper to use Apple's supported platform will encourage people to use tfjs-node much much more. |
for Monterey, tfjs-node is installed, but while running code gives error |
@mehimanshupatil were you able to solve this issue when running Monterey? If so, how? :) |
no, I was not able to solve the issue. |
@mehimanshupatil Sorry to hear, thanks for answering 👍
@ozenhaluk Did you end up having any success with using tfjs-node on Monterey? |
Same issues on
with {
"dependencies": {
"@tensorflow/tfjs-converter": "^2.7.0",
"@tensorflow/tfjs-core": "^2.7.0",
"@tensorflow/tfjs-node": "^2.7.0"
},
} I get
|
@Caundy no unfortunately |
Why is this issue closed? |
Hi @louismullie @ozenhaluk ! I am able to execute above command with latest tfjs-node version in my mac-m1. Thank you! |
Has this issue been solved? I'm on MacOS Ventura with a M1 Pro Mac, and I got this error when downloading a lib which used tensorflow:
|
@RayBytes Has the library you're using updated their dependencies? Definitely not an issue for this project tho. I'd file an issue with that project. |
I'm getting a similar error and I'm on MacOS Ventura with an M1 Pro Mac too, this happened to me when running
|
|
Hi @mattsoulanille I was running the terminal without rosetta. I'm using Node 20.5.1. |
If you create a new clean npm package and just run const tf = require('@tensorflow/tfjs-node');
tf.tensor1d([1,2,3]).add(tf.tensor1d([4,5,6])).print(); You should see
I'm interested in knowing where this process fails. At the install step, the |
System information
Describe the problem
Installation fails due to a missing precompiled
libtensorflow
for darwin / arm64.Apple has their own fork of TensorFlow supporting their chips-- is there a way to tell the installation script to use their
libtensorflow.dylib
?Provide the exact sequence of commands / steps that you executed before running into the problem
npm install @tensorflow/tfjs-node --save
Any other info / logs
The text was updated successfully, but these errors were encountered: