zoukankan      html  css  js  c++  java
  • 安装pytorch GPU版不能使用问题

    虽然我已经安装了GPU版的pytorch,但是只能使用CPU的。

    安装的pytorch版本pytorch1.5.1-py36-cu102-cudn70

    执行:

    >>> import torch
    >>> import torchvision
    >>> torch.cuda.is_available()
    False

    因为anconda也确实安装了cudatoolkit 10.2.89,不能用感觉莫名其妙,就在程序中的:

    DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu") # 让torch判断是否使用GPU

    强制改成:

    DEVICE = torch.device('cuda')

    结果运行报错:

    AssertionError: 
    The NVIDIA driver on your system is too old (found version 10010).
    Please update your GPU driver by downloading and installing a new
    version from the URL: http://www.nvidia.com/Download/index.aspx
    Alternatively, go to: https://pytorch.org to install
    a PyTorch version that has been compiled with your version
    of the CUDA driver.

    原来是驱动版本太低,找到原因自然就好解决了。

    然后重新安装cuda10.2就可以正常使用了。

    说明,之前我安装cuda10.2的时候是自定义安装的,只安装了cuda,其他组件都没有安装。

    安装后

    (base) C:UsersAdministrator>conda activate pytorch
    
    (pytorch) C:UsersAdministrator>python
    Python 3.6.10 |Anaconda, Inc.| (default, May  7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import torch
    >>> print(torch.cuda.is_available())
    True

    另外,下面这里也可以查看cuda驱动版本。

  • 相关阅读:
    org.apache.maven.archiver.MavenArchiver.getManifest错误
    常见电商项目的数据库表设计(MySQL版)
    二、Log4j基本使用方法
    Java Dao设计模式
    JavaBean简单及使用
    jsp的9个内置对象
    JSP+MySQL实例
    JSP指令--include指令(静态包含)
    三种Scriptlet总结
    ***mysql 用一个表的一列,去更新另一表的一列
  • 原文地址:https://www.cnblogs.com/juluwangshier/p/13334726.html
Copyright © 2011-2022 走看看