-
Notifications
You must be signed in to change notification settings - Fork 808
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
wrong architecture tokenizers.cpython-39-darwin.so
(x86_64) when installing on apple silicon (arm64)
#712
Comments
tokenizers.cpython-39-darwin.so
when installing on apple silicontokenizers.cpython-39-darwin.so
(x86_64) when installing on apple silicon (arm64)
Hi @hkennyv and thank you for reporting this. We don't build wheels for Apple Silicon at the moment because there is no environment for this on our Github CI. (cf actions/runner-images#2187). The only way to have it working is, as you mentioned, to build it yourself. We'll add support for this as soon as it is available! |
@n1t0 thanks for the response & explanation! i've +1'd the issue you linked to (hopefully) help :) |
Hi there ! I've manually build binaries for tokenizers on arm m1 and released them for tokenizers We'll try our best to keep building those by hand while waiting for actions/runner#805. Expect some delay between normal releases and m1 releases for now :) Have a great day ! |
I followed the manual build instructions from the solution of the original comment, but am getting the error
I am trying to run AutoModelForTokenClassification |
Hi @McPatate, thanks for building the bindings manually! Two months after your post, there was an announcement about pre-release version of the macOS-ARM64 runner. Will it make things easier? @n1t0 you can also track the recent roadmap issue github/roadmap#528. |
I'm having the same issue. After running: Full output: |
@WALEX2000 I'm not sure we have arm binaries for Maybe @Narsil can chime in :) |
I have followed the instructions to build from source, and I still see the library be x86_64 compiled. I cloned the repo, made sure the Python environment is configured for shared library, and ran
Ran the following command to check the built compiled lib. file .venv/lib/python3.10/site-packages/tokenizers-0.13.0.dev0-py3.10-macosx-12.2-arm64.egg/tokenizers/tokenizers.cpython-310-darwin.so Output:
I do not understand why it is not compiling for the correct target. I am on a M1 Macbook pro. Python version is 3.10.7. Cargo version is 1.63.0. |
I ran into this as well. It turned out that I was using the brew installed rust rather than the rustup one. Try |
@spullara I did. It was the rustup one and not Brew. |
It may also be defaulting to the wrong toolchain. You might also try setting the default toolchain with
I think I also had to delete rust-toolchain as when it was present it would change to the x86_64 toolchain. You can check to make sure the right one is selected with
Edit: I was able to fix the rust-toolchain issue by doing
|
@spullara I ran
|
The errors you are seeing are super odd indeed, are you running into some sort of compatibility mode ? Could you try and check the rust install is OK by running |
Did you run this in the tokenizers/bindings/python directory? |
I get this when I run it in
|
That means you need to this command I had to do to change the default host:
|
Thanks. |
@hkennyv thank you so much for this! It's July 2023, and following your instructions for the tokenizers (and the same thing for safetensors) was the only way I could get the huggingface dependencies I needed all running. Does anyone know if there's a better way yet that I couldn't find? |
You're running a too old Python version (or too new). |
Hi @hkennyv Is there any permanent solution to install tokenizer in MAC M1 pro ?? |
Hey there,
I just wanted to share an issue I came by when trying to get the transformers quick tour example working on my machine.
It seems like, currently, installing
tokenizers
via pypi builds or bundles thetokenizers.cpython-39-darwin.so
automatically forx86_64
instead ofarm64
for users with apple silicon m1 computers.System Info: Macbook Air M1 2020 with Mac OS 11.0.1
To reproduce:
create virtualenv
virtualenv venv-bad
and activate itsource venv-bad/bin/activate
install pytorch (easiest way i've found so far on arm64 is to install nightly via
pip
)pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
install transformers (tokenizers will be installed as a dependency)
pip install transformers
create a file with quick tour example:
main.py
Results in error:
Full stacktrace
Looking at the architecture of the shared lib using
find
, we can see it's a dynamically linked x86_64 librarySolution:
The solution I found requires installing the rust toolchain on your machine and installing the
tokenizers
module from source so I think this is best as a temporary solution. I already have the rust nightly toolchain installed on my machine, so that's what I used. Otherwise, instructions for installing are here.tokenizers
cd tokenizers/bindings/python
python setup.py install
We can also now see that the shared library is the proper architecture using
file
:I'm not super well versed in setuptools, so I'm not sure best way to fix this. Maybe release a different pre-built shared
tokenizers.cpython-39-darwin.so
forarm64
users? I'd be happy to help if needed.The text was updated successfully, but these errors were encountered: