Skip to content
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

M1 mac 使用不了 #41

Open
acer1456 opened this issue Dec 6, 2021 · 2 comments
Open

M1 mac 使用不了 #41

acer1456 opened this issue Dec 6, 2021 · 2 comments

Comments

@acer1456
Copy link

acer1456 commented Dec 6, 2021

在跑的時候,CMD跳出下面這行

F tensorflow/core/framework/tensor.cc:681] Check failed: IsAligned()

想問有沒有方法可以解?

@yuwchen
Copy link

yuwchen commented May 23, 2022

不是遇到相同的error,
但我在Mac M1上先裝虛擬環境再裝特定版本的tensorflow是可以跑的,提供參考

(1)先安裝虛擬環境(virtualenv or conda)
(2)創建環境 (e.g. conda create -n myenv python==3.8.5)
(3)啟動虛擬環境(e.g. conda activate myenv)
(4)下載特定版本tensorflow:
https://drive.google.com/drive/folders/1oSipZLnoeQB0Awz8U68KYeCPsULy_dQ7
(5)安裝 tensorflow (pip install --force-reinstall ~/Downloads/tensorflow-2.4.1-py3-none-any.whl)

參考網址:
https://stackoverflow.com/questions/65383338/zsh-illegal-hardware-instruction-python-when-installing-tensorflow-on-macbook

@wastu01
Copy link

wastu01 commented Sep 22, 2024

我遇到其他 error,這邊分享我的解決方式:

我的環境是 M1 MacOS, Python 3.10.14,
tensorflow==2.16.2 tf_keras==2.16.0 tensorflow-metal==1.1.0

在安裝 CkipTagger 前,需要先安裝 TensorFlow,依 Apple 官方指引 安裝 Metal Plugin,因為對應的 TensorFlow 為 2.5 以上,根據 這篇 issue 提到的方法,額外安裝 tf_keras,並設定環境變數 TF_USE_LEGACY_KERAS=1,就可以執行 CkipTagger。

另外不同版本的 TensorFlow 需要安裝對應版本的 tensorflow-metal,因為該套件沒有 source code,只提供與特定 TensorFlow 版本編譯好的 binary 檔案。
詳細版本細節可以在這裡查看:
https://pypi.org/project/tensorflow-metal
https://pypi.org/project/tensorflow-metal/#files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants