TensorFlow-gpu 2.5已发布,但官方网页还没有通知。
该版本已由google开发人员Mihai Maruseac发布在pypi网站
不过已经上线,查看地址链接:
地址一:
https://libraries.io/pypi/tf-nightly-gpu
地址二:
https://pypi.org/project/tf-nightly-cpu/
如果不想直接下载那就选择阿里云镜像源安装即可,安装之前请检查自己的cuda,nvidia,cudnn版本匹配情况,这里就不做介绍:可以参考我的博客文章:
(ubuntu版本)快速下载NVIDIA最新显卡驱动RTX3080ti、GTX1650ti、CUDA11.2,CUDNN的地址
赶快收藏:快速安装PyTorch和TensorFlow(gpu+cpu+1.7.1+2.2.0)命令
【长篇博文】Docker学习笔记(四):镜像的分层、打包、双向绑定、导入导出、Dockerfile的构建、部署与发布
【长篇博文】Docker学习笔记与深度学习环境的搭建和部署(二)
安装命令:
pip install tf-nightly-gpu==2.5.0 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
测试是否安装成功:
安装完成后,进入Python环境,验证是否安装成功:
代码如下:
import tensorflow as tf
print(tf.__version__,tf.test.is_gpu_available())
如果就是True说明安装成功,gpu已经可以使用。
下载离线whl文件:http://mirrors.aliyun.com/pypi/simple/tensorflow-gpu/
这里附加windows10下的torch和TensorFlow的gpu使用教程:
当前驱动与cuda信息:
pytorch下载地址:https://download.pytorch.org/whl/torch_stable.html
下载后自行安装:
验证torch-gpu是否可用:测试代码
import torch
flag = torch.cuda.is_available()
print(torch.__version__,flag)
ngpu= 1
# Decide which device we want to run on
device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")
print(device)
print(torch.cuda.get_device_name(0))
print(torch.rand(3,3).cuda())
运行结果:
TensorFlow:
pip install tf-nightly-gpu -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
测试代码同上,测试结果为
google官网安装TF-gpu参考:
https://colab.research.google.com/tf-nightly
阿里云下载TF-gpu轮子whl文件:
http://mirrors.aliyun.com/pypi/simple/tensorflow-gpu/
TF官网gpu与cuda匹配版本参考:
https://tensorflow.google.cn/install/source
参考文献:
https://pip.pypa.io/en/stable/reference/pip_install/#hash-checking-mode
https://blog.csdn.net/scp_6453/article/details/110715974
pytorch版本与cuda版本参考:https://blog.csdn.net/weixin_41194129/article/details/113394203
其他参考:https://www.cnblogs.com/
安装cuda和cudnn:搜索安装方式
conda search cudatoolkit
conda install cudatoolkit=?
conda search cudnn
conda install cudnn=?