zoukankan      html  css  js  c++  java
  • pytorch使用过程中遇到的一些问题

    问题一

    ImportError: No module named torchvision

    torchvison:图片、视频数据和深度学习模型

    解决方案

    安装torchvision,参照官网


    问题二

    安装torchvision过程中遇到 Could not find a version that satisfies the requirement olefile (from pillow->torchvision==0.1.8) 

    没有olefile

    解决方案

    安装olfile,官网


    问题三

    找不到nn.init模块

    具体错误内容 'module' object has no attribute 'init'

    解决方案

    找到以下目录torch/nn, 此目录下有init.py和__init__.py文件,打开__init__.py文件看到以下内容:

     
    1. from .modules import *  
    2. from .parameter import Parameter  
    3. from .parallel import DataParallel  

    在代码的最后加上以下语句

     
    1. from .init import *  


    保存并退出,重新运行即可

    问题四:torch not compiled with cuda enabled

    解决方案

    最好根据github上的教程,进行源安装:网址:https://github.com/pytorch/pytorch

    安装好之后进行测试:a = torch.ones(1,1)

    print a.cuda() 有结果,说明安装成功,需要torchvision,那么conda install torchvision -c soumith提示安装pytorch(cuda)和torchvision,选择yes的话,基本上失败,下载pytorch太慢! 如果conda install torchvision选择yes的话,之后再import torch是会报错:Undefined symbol:THLongStorage_inferSizeN.(不知道什么原因,果断选择避坑)。

    安装torchvision:去官网下载离线包:.whl格式,之后在终端pip install 这个格式的包

  • 相关阅读:
    WeakReference(弱引用)
    男人怎么挑选女人
    同步方法和异步方法
    常指针与指针常量的区别(转帖)
    关于WebService的一些注意事项
    ASP.Net缓存技术
    关于GridView手动绑定的一段代码,一切尽在不言中
    基本三层架构的一些代码
    写给自己看的关于DataList的和RePeater
    ASP.Net绑定数据源
  • 原文地址:https://www.cnblogs.com/qinduanyinghua/p/7157915.html
Copyright © 2011-2022 走看看