aigamedev / scikit-neuralnetwork

Deep neural networks without the learning cliff! Classifiers and regressors compatible with scikit-learn.
BSD 3-Clause "New" or "Revised" License
1.21k stars 220 forks source link

ImportError: cannot import name downsample #235

Open zyui opened 7 years ago

zyui commented 7 years ago

`from sknn import ae import numpy as np import warnings warnings.filterwarnings("ignore", category=DeprecationWarning)

x = np.asarray(range(0,16))

nn = ae.AutoEncoder( layers=[ ae.Layer("Sigmoid", units=4), ae.Layer("Sigmoid", units=8), ae.Layer("Sigmoid", units=4) ], learning_rate=0.02) nn.fit(x)`

And then comes the arror_Traceback (most recent call last): File "/Users/zzzyui/Desktop/CSE514A/hw4/ae1.py", line 17, in learning_rate=0.02) File "/Library/Python/2.7/site-packages/sknn/nn.py", line 513, in init self._setup() File "/Library/Python/2.7/site-packages/sknn/ae.py", line 100, in setup backend.setup() File "/Library/Python/2.7/site-packages/sknn/backend/init.py", line 24, in setup from . import lasagne File "/Library/Python/2.7/site-packages/sknn/backend/lasagne/init.py", line 5, in from .mlp import MultiLayerPerceptronBackend File "/Library/Python/2.7/site-packages/sknn/backend/lasagne/mlp.py", line 25, in import lasagne.layers File "/Library/Python/2.7/site-packages/lasagne/init.py", line 19, in from . import layers File "/Library/Python/2.7/site-packages/lasagne/layers/init.py", line 7, in from .pool import * File "/Library/Python/2.7/site-packages/lasagne/layers/pool.py", line 6, in from theano.tensor.signal import downsample ImportError: cannot import name downsample

MarcAbonce commented 7 years ago

Related to #234. The only workaround I found for now is to force pip to downgrade Theano to 0.7.

dibidave commented 7 years ago

This issue is happening because the latest released version of Lasagne (0.1) still uses downsample from Theano, but the latest released of Theano no longer supports downsample. @zyui @a01200356 If you prefer to use the newest version of Theano, you could alternatively upgrade Lasagne to the development version via pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip (a la http://lasagne.readthedocs.io/en/latest/user/installation.html)

609805584 commented 7 years ago

change from theano.tensor.signal.pool import max_pool_2d to from theano.tensor.signal.pool import pool_2d

ovcharenkoo commented 7 years ago

@dibidave Worked for me, thanks!

NalaLionQueen commented 7 years ago

@dibidave It works for me! Thank you!

Jaircito commented 7 years ago

@dibidave worked for me, thank you!

msiraj83 commented 7 years ago

@dibidave ..thanks its work for me..

syys96 commented 6 years ago

@dibidave It works for me, thank you!

pyrole commented 6 years ago

@dibidave, Thanks..that worked

t-rodriguez commented 6 years ago

Worked for me too, thanks, @dibidave.

ynandwan commented 6 years ago

@dibidave Thanks! It worked

quanap5 commented 6 years ago

Thank you so much @dibidave It worked .

anbai106 commented 6 years ago

Sorry to reask this question again:

I installed the theano with version of 1.0.2, but I can not import the downsample module, I saw several posts for the same issue, and I tried to upgrade the version of Lasagne pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip

, but it did not work for me.

I saw that the question was asked with theano for version of 0.8. So I wonder if anyone has the same issue for the lasted version of theano and has some workaround?

Thanks in advance

gabefair commented 5 years ago

pip install -I theano==0.7 for anyone who needs it

khodjabekova commented 5 years ago

@dibidave Thanks a lot!!!

nhanph commented 5 years ago

@dibidave that works for me too. Thanks a lot!

bhavikapanara commented 4 years ago

You just need to install Theano & Lasagne again by following commands.

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