Mac M1 运行tensorflow2.x报错model: “0“ num_cores: 8 environment { key: “cpu_instruction_set“ value:

报错信息如下:

2022-04-12 22:17:09.670204: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
2022-04-12 22:17:09.673631: W tensorflow/core/platform/profile_utils/cpu_utils.cc:126] Failed to get CPU frequency: 0 Hz
2022-04-12 22:17:09.683158: F tensorflow/core/grappler/costs/op_level_cost_estimator.cc:710] Check failed: 0 < gflops (0 vs. 0)type: “CPU”
model: “0”
num_cores: 8
environment {
key: “cpu_instruction_set”
value: “ARM NEON”
}
environment {
key: “eigen”
value: “3.3.90”
}
l1_cache_size: 16384
l2_cache_size: 524288
l3_cache_size: 524288
memory_size: 268435456

在这里插入图片描述
看了很多文章,都是说新建一个.sh文件,复制以下内容即可解决

#!/bin/bash
set -e
VERSION=0.1alpha3
INSTALLER_PACKAGE=tensorflow_macos-$VERSION.tar.gz
INSTALLER_PATH=https://github.com/apple/tensorflow_macos/releases/download/v$VERSION/$INSTALLER_PACKAGE
INSTALLER_SCRIPT=install_venv.sh
echo
# Check to make sure we're good to go.
if [[ $(uname) != Darwin ]] || [[ $(sw_vers -productName) != macOS ]] || [[ $(sw_vers -productVersion) != "11."* ]] ; then 
  echo "ERROR: TensorFlow with ML Compute acceleration is only available on macOS 11.0 and later." 
  exit 1
fi
# This 
echo "Installation script for pre-release tensorflow_macos $VERSION.  Please visit https://github.com/apple/tensorflow_macos "
echo "for instructions and license information."   
echo
echo "This script will download tensorflow_macos $VERSION and needed binary dependencies, then install them into a new "
echo "or existing Python 3.8 virtual environment."
# Make sure the user knows what's going on.  
read -p 'Continue [y/N]? '    
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
echo
echo "Downloading installer."
tmp_dir=$(mktemp -d)
pushd $tmp_dir
curl -LO $INSTALLER_PATH 
echo "Extracting installer."
tar xf $INSTALLER_PACKAGE
cd tensorflow_macos 
function graceful_error () { 
  echo 
  echo "Error running installation script with default options.  Please fix the above errors and proceed by running "
  echo 
  echo "  $PWD/$INSTALLER_SCRIPT --prompt"
  echo 
  echo
  exit 1
}
bash ./$INSTALLER_SCRIPT --prompt || graceful_error 
popd
rm -rf $tmp_dir

(可是运行这个脚本的时候出现ERROR: TensorFlow with ML Compute acceleration is only available on macOS 11.0 and later.错误,然而自己的Mac版本都12.几了,还是报这个错误!
在这里插入图片描述

问题解决:

只需要终端执行pip安装即可!复制以下命令执行。

pip install --upgrade --force --no-dependencies https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_addons_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl

在这里插入图片描述
成功运行!!!
在这里插入图片描述









😍😍😍

若本文对你有所帮助不妨点个赞点➕关注

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

令人作呕的溏心蛋

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值