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 这个格式的包

  • 相关阅读:
    POJ 3348 Cows (凸包面积)
    P4126 [AHOI2009]最小割
    P1903 [国家集训队]数颜色
    P3749 [六省联考2017]寿司餐厅
    CF666E Forensic Examination
    P2336 [SCOI2012]喵星球上的点名
    P1117 [NOI2016]优秀的拆分
    P3747 [六省联考2017]相逢是问候
    CF1062F Upgrading Cities
    P3243 [HNOI2015]菜肴制作
  • 原文地址:https://www.cnblogs.com/qinduanyinghua/p/7157915.html
Copyright © 2011-2022 走看看