MacOS M1 configures Tensorflow and Pytorch

To install Pytorch, refer to this article: https://zhuanlan.zhihu.com/p/522534035

It is possible to report an error:

 The reason for this problem is that the version of pytorch is too low and does not support it. The reason for this problem is that when conda is installed, the normal version may be installed instead of the nightly version (you can check the version by yourself after installation).

The solution is to go to pytorch's official website: https://pytorch.org/get-started/locally/

Then copy the command generated below, you can solve this problem (MacOS 12.3+)

 

Install TensorFlow:

Problems encountered:

The first error that may be reported:

RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd

It is said that the numpy version is too low, but conda checks that it is already the latest 1.23

I found a solution to this problem by mistake:

First uninstall numpy (you cannot use conda to uninstall, conda will automatically uninstall a lot of other things together, and there will be many problems): pip uninstall numpy. Then if you enter pip install numpy at this time, it will show that numpy already exists (don't know why), but the version is 1.19. At this time, only pip install --upgrade numpy is needed, and it will be updated to 1.23, and no error will be reported at this time.

The second problem: AssertionError: Duplicate registrations for type 'optimizer'

The solution is to uninstall keras (also pip), and then there is no error

After the installation is complete, there may be two red warnings, but it does not affect the operation

I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)

This current problem is very common, but there seems to be no solution, the forum is as follows:

Could not identify NUMA node of pl… | Apple Developer Forums

Guess you like

Origin blog.csdn.net/qq_41934338/article/details/125695116