背景简介
作为一个对深度学习极其富有好奇心,但一直不得入门的小白来说,前几天终于看到了 《深度学习之TensorFlow:入门、原理与进阶实战 》这本书,通过这本书算是终于看懂了一些,于是准备用自己电脑实地操练一番。
需要安装的软件
此处假设当前机器是全新机器!!!
- Anaconda
- Tensorflow && Tensorflow-gpu (由于书籍上面的示例多数是v1版本的,所以此处安装 v1.15)
- CUDA 10.0
- CUDNN
Anaconda
下载地址:https://repo.anaconda.com/archive/
目前最新版本为:https://repo.anaconda.com/archive/Anaconda3-2020.07-Windows-x86_64.exe
Anaconda 安装就比较傻瓜式了,下一步,下一步,完成就好
这里由于我不准备随便开个 cmd 就能用,所以就不选 ADD PATH 了.
CUDA 10.0
CUDA
是什么呢,CUDA
的官方文档是这么介绍CUDA
的:
a general purpose parallel computing platform and programming model that leverages the parallel compute engine in NVIDIA GPUs to solve many complex computational problems in a more efficient way than on a CPU.
换句话说CUDA
是NVIDIA
推出的用于自家GPU
的并行计算框架,也就是说CUDA
只能在NVIDIA
的GPU
上运行,而且只有当要解决的计算问题是可以大量并行计算的时候才能发挥CUDA
的作用。
下载地址:https://developer.nvidia.com/cuda-downloads
这里选择安装 10.0
版本,从官网上看到最新版本的 tensorflow
支持 10.1
了,但是写了 v2
所以比较担心 v1
不支持所以就不作死安装 10.1
了。
- 网站默认下载版本是最新版本,由于我们安装的版本是
10.0
所以需要先点击Legacy Rekeases
按钮,下载之前的版本。
- 然后选择我们需要再在的版本
- 选择对应的平台开始下载,此处不能直接下载,需要在下载按钮右键
复制链接地址
然后借助迅雷下载。
- 打开迅雷,新建下载任务,等待下载完成即可。
CUDNN
下载地址:https://developer.nvidia.com/rdp/cudnn-download
CUDNN
可以理解为 CUDA
的一个补丁,用来加速深度学习的一些运算的,特地针对深度学习进行优化了,但是下载需要登陆,但是网上说不安装也能继续使用,具体安装不安装就看自己了,我这边注册了个账号并下载安装了。
Tensorflow && Tensorflow-gpu
使用 Anaconda
安装 Tensorflow
就很简单了。
- 首先打开控制台。
- 依次执行下面的命令即可,网上安装出错很多都是由于网络原因,或者
python
版本不对导致的。
# 新建环境
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
conda create -n tensorflow python=3.7
conda activate tensorflow
# 安装 tensorflow
pip install -i https://mirrors.aliyun.com/pypi/simple/ tensorflow==1.15
pip install -i https://mirrors.aliyun.com/pypi/simple/ tensorflow-gpu==1.15