-
Notifications
You must be signed in to change notification settings - Fork 3
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
Incompatibility with Mac M1 (ARM-based) #26
Comments
No incompatibility that I'm aware of, the typical issue for Mac is a mismatch between libtensorflow build and system architecture. That's what it looks like here. For instance, I see that your architecture is arm64 but the libtensorflow build is for x86_64. Probably you should obtain a libtensorflow build that matches your system (or just build the libtensorflow package from source). Probably also double-check your import statements within internal/tensor/prepare_tensor.go, etc. |
Yes, see Build from Source at the bottom of the page that you linked. |
I'm also having issues with M1. When using this from a normal go project it works ok, I can run the example and it will work just fine. However it fails with if I try to use bazel in the project. I then tried to downlaod graft and build it independently but I hit the same error:
Seems like there is no option to build for m1? |
Hi @vicentsegui, I tried in the past to build the TensorFlow from source but no luck, finally I downloaded it from homebrew and pointed the env var to that path. |
Hi @joseangel-mm I also have the brew installed version (I adjust the CGO_LFLAGS and CGO_LDFLAGS accordingly), the problem comes when trying to compile the actual go bindings which seem to be confused about what to build because there is no arm64 macos platform defined. @joseangel-mm did you setup any other env paths? |
As I commented, finally I used the TensorFlow from homebrew and I updated these variable environments. |
@vicentsegui correct, for ARM this library will only work using Go directly after installing a pre-built libtensorflow. And for ARM this library will not work using Bazel. The reason for this is that running Bazel build on this library does not compile libtensorflow, rather it downloads the official libtensorflow release for that platform (system architecture). And there is not an official libtensorflow release for ARM. |
Could we add a local_repository build rule for the macos arm version that links to the homebrew version? |
@vicentsegui let's see if this works. Try: git clone -b bzl-test-other-platforms https://github.com/wamuir/graft.git
cd graft/tensorflow
bazel build --repo_env=LIBTENSORFLOW_PKG_URL=file:///path/to/libtensorflow.tar.gz :all Replace |
I packed my libtensorflow with
The libraries can be found under lib/ inside the package, trying to compile complains about them missing:
Also tried with |
I gave it another try today and managed to make it worl @wamuir I think I had the wrong tar on the path. It now builds tensorflow on M1. |
Do you plan on merging this to your main branch? |
@vicentsegui yes #28 will merge it into nightly (default branch) |
Hi, seems like the new release now supports macos m1 so this may no longer be needed? |
Hi, I am working on a project that uses C
tensorflow
library on Golang and I am struggle with some issues in my Mac M1 (ARM-based).Basically, in the past I had some issues with the TensorFlow library itself but I solved that changing the
GOOS
environmental variable toios
instead ofdarwin
.Once I did that change, when I run my app (
go run main.go
), I get the following error, so I would like to know ifgithub.com/wamuir/graft/tensorflow
is compatible with ARM Mac:The previous error (when I have
GOOS='darwin'
), was the following:The version of github.com/wamuir/graft I am using is 0.7.0 and the TensorFlow version is
libtensorflow-cpu-darwin-x86_64-2.15.0
that is located in/usr/local/lib
.Thanks in advanced.
The text was updated successfully, but these errors were encountered: