zoukankan      html  css  js  c++  java
  • windows 10环境下安装Tensorflow-gpu

     网上有很多教程,特别是简写上的写的都还算比较详细。但我自己还是遇到了几个坑,希望对深度学习有兴趣的同学遇到跟我一样的坑,希望这份记录能帮助到你。

    问题一:要不要使用Anaconda?

    我看极客时间上的视频课《Tensorflow快速入门与实践》,留言版块上也有讨论这个,视频课中没有用,给出的理由是太大了,几个G。https://time.geekbang.org/discuss/detail/62837

    有利弊吧,管理版本方便,但也增加了一定的复杂度。自己觉得好就行~

    问题二:pip install tensorflow-gpu 下载慢怎么办?

    用国内的镜像,不要就得翻墙。用法:pip install -i https://mirrors.aliyun.com/pypi/simple/ --upgrade tensorflow-gpu==1.14.0

    -i 后面跟着是镜像的网址,上面用的是阿里云的,国内还有例如清华大学等镜像,自行搜索一下就行。

    建议使用2.0的版本,截止目前为止 2.0.0.b1 很多用法已经进行了较大的调整,特别是API。你从网上下载的代码和学习使用的代码,可能都需要进行修改,无疑增加了学习的难度,建议最高用 1.14.0或者更低的版本

    问题三:不同的 Tensorflow-gpu 该安装何种 CUDA 和 cuDNN 版本呢?

    查看链接 https://tensorflow.google.cn/install/source_windows ,注意查看文章不要使用中文,中文的翻译没有 1.14.0(翻译可能滞后了)

    千万记得一定要下载匹配的版本,不然会有问题的。

    你的显卡是否支持 CUDA 的版本,可以通过这个网址查看:https://developer.nvidia.com/cuda-gpus

    CUDA 下载  https://developer.nvidia.com/cuda-downloads

    cuDNN 下载 https://developer.nvidia.com/rdp/cudnn-download

    如果你确实想尝新,记得查看官网的文档:https://tensorflow.google.cn/beta/guide/migration_guide 

    问题四:遇到 failed call to cuInit: CUDA_ERROR_UNKNOWN 错误怎么办?

    我就遇到了,折腾的死去活来的,最终发现是自己手痒的问题,不该升级显卡驱动的。 TF 的版本,我从1.x 换到 2.0 然后又换回来,光 CUDA 与 cuDNN 都卸载重装好多次了,电脑了重启了N次,还是失败。

    最后找到一篇在ubuntu上遇到这个问题的文章,说是显卡驱动问题,然后我从官网重新下载了 windows 的驱动,安装后正常了。  显卡驱动下载地址:https://www.nvidia.cn/Download/index.aspx?lang=cn

    问题五:如何验证是否安装成功了(仅限 TF 1.x)

    cmd -> python 

    进入 python 命令行之后,使用下面的代码进行验证

    > import tensorflow as tf

    > sess = tf.Session()

    如果一切正常,会输出

    Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tensorflow as tf
    >>> sess = tf.Session()
    2019-08-11 17:38:01.267862: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll
    2019-08-11 17:38:01.393012: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
    name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7085
    pciBusID: 0000:01:00.0
    2019-08-11 17:38:01.397606: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
    2019-08-11 17:38:01.400748: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
    2019-08-11 17:38:01.403269: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
    2019-08-11 17:38:01.408338: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
    name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7085
    pciBusID: 0000:01:00.0
    2019-08-11 17:38:01.412305: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
    2019-08-11 17:38:01.415404: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
    2019-08-11 17:38:02.046658: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
    2019-08-11 17:38:02.050748: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0
    2019-08-11 17:38:02.052282: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N
    2019-08-11 17:38:02.054474: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4712 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1)
    >>>

    环境安装完了,从网上随便找一个验证码识别的例子开始玩起来吧~

  • 相关阅读:
    java小白学习练手成绩管理系统(一)
    java初级学习练手成绩管理系统(四)
    Echart可视化学习集合
    java小白学习练手成绩管理系统(六)
    java小白学习练手成绩管理系统
    网页内容加密
    Ubuntu 10.04 安装配置指南
    Linux目录解释
    完整清除XP垃圾文件系统自带的秘密武器
    人人都应该掌握的一些电脑操作技巧
  • 原文地址:https://www.cnblogs.com/meteoric_cry/p/11335779.html
Copyright © 2011-2022 走看看