卷积神经网络框架Lasagne与深度学习库Theano在Windows平台可能存在版本不匹配的问题

3
所以我终于成功地使用这个指南,在GPU上运行theano。(测试代码运行良好,告诉我它使用了GPU,太棒了!!) 然后我想尝试一下,并按照这个指南训练一个CNN进行数字识别。 问题是:我从lasagne调用theano的方式中得到错误(我猜这里存在版本不匹配):
Using gpu device 0: GeForce GT 730M (CNMeM is disabled, cuDNN not available)
Traceback (most recent call last):
File "C:\Users\Soren Jensen\Desktop\CNN-test\CNNTest-one.py", line 7, in <module>
import lasagne
File "C:\Users\Soren Jensen\Anaconda3\lib\site-packages\lasagne\__init__.py", line 19, in <module>
from . import layers
File "C:\Users\Soren Jensen\Anaconda3\lib\site-packages\lasagne\layers\__init__.py", line 7, in <module>
from .pool import *
File "C:\Users\Soren Jensen\Anaconda3\lib\site-packages\lasagne\layers\pool.py", line 6, in <module>
from theano.tensor.signal import downsample
ImportError: cannot import name 'downsample'
Press any key to continue . . .

根据错误消息的内容,似乎'downsample'已更改,为什么我的lasagne还在调用它?

尝试更新我的lasagne版本时出现以下错误:

C:\WINDOWS\system32>pip3.5 install Lasagne==0.1
Collecting Lasagne==0.1
Requirement already satisfied: numpy in c:\users\soren jensen\anaconda3\lib\site-packages (from Lasagne==0.1)

并运行代码示例

import theano
import os
print(theano.config.compiledir)

print("Theano version %s" % theano.__version__)
theano_dir = os.path.dirname(theano.__file__)
print("theano is installed in %s" % theano_dir)

显示Python3.5使用Theano v0.9

Using gpu device 0: GeForce GT 730M (CNMeM is disabled, cuDNN not available)
C:\theano_compiledir\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-3.5.2-64
Theano version 0.9.0.dev-e5bedc0de240eca42433c34c05fc00f4a5ef6cbe
theano is installed in C:\Users\Soren Jensen\Anaconda3\lib\site-packages\theano\theano
Press any key to continue . . .

抱歉篇幅有点长,但我已经因为这个问题疯狂了。也许我在版本不匹配方面错了,错误可能是其他原因引起的吗?

1个回答

9

尝试按照以下方式重新安装Theano和Lasagne:

pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip

因为: "即使是更近期的 Theano 版本通常也能够工作,但在撰写本文时,通过简单的 pip 安装 Theano 将会得到一个过于陈旧的版本。" 阅读更多: lasagne.readthedocs.io/en/latest/user/installation.html

运行得很好。 - max
抱歉回复晚了,但确实有效。谢谢! - Søren Jensen
这帮助我解决了“ImportError: cannot import name 'downsample'”错误,但是我现在遇到了类型错误。https://stackoverflow.com/questions/44772986/type-mismatch-tensortypefloat64-row-tensortypefloat64-matrix - weima

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接