Macbook M1安装tensorflow-gpu教程

macbook M1安装tensorflow-gpu教程:https://developer.apple.com/metal/tensorflow-plugin/

chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
一路yes即可
# source ~/miniforge3/bin/activate
source /Applications/Software/miniforge3/bin/activate
conda create -n tensorflow-gpu pip python=3.9
source activate tensorflow-gpu
conda install -c apple tensorflow-deps
conda install -c apple tensorflow-deps==2.6.0
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal

测试代码:

import tensorflow as tf
print(tf.__version__)

#加载mnist数据集
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()

model = tf.keras.models.Sequential([
    tf.keras.layers.Flatten(input_shape=[28, 28]),
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Dropout(0.2),
    tf.keras.layers.Dense(10, activation='softmax')
])

#编译
model.compile(optimizer='adam',
            loss='sparse_categorical_crossentropy',
            metrics=['accuracy'])
#训练模型
model.fit(x_train, y_train, epochs=5, batch_size=64)
model.evaluate(x_test, y_test)

labelme安装

conda create --name=labelme python=3.9
conda activate labelme
pip install pyqt5 
pip install labelme
source activate labelme
labelme
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值