Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lasagne and nolearn version #8

Open
tanayz opened this issue Dec 15, 2015 · 6 comments
Open

lasagne and nolearn version #8

tanayz opened this issue Dec 15, 2015 · 6 comments

Comments

@tanayz
Copy link

tanayz commented Dec 15, 2015

When I run this code I get following error which I believe is happening because of version conflict of lasagne or nolearn between build and present version. Could you tell me what version or commit-point of lasagne and nolearn you have used in this project.

File "/home/tanay/src/lasagne/lasagne/layers/conv.py", line 391, in init
super(Conv2DLayer, self).init(incoming, **kwargs)

TypeError: Failed to instantiate <class 'lasagne.layers.conv.Conv2DLayer'> with args {'b': <lasagne.init.Constant object at 0x7fab337e74d0>, 'incoming': <lasagne.layers.input.InputLayer object at 0x7fab31f54390>, 'name': 'conv2d1', 'nonlinearity': <lasagne.nonlinearities.LeakyRectify object at 0x7fab3b5e0250>, 'filter_size': (4, 4), 'stride': (2, 2), 'W': <lasagne.init.Orthogonal object at 0x7fab337e7450>, 'num_filters': 32, 'untie_biases': True, 'border_mode': 'same'}.
Maybe parameter names have changed?

@sveitser
Copy link
Owner

Are you using the nolearn and lasagne versions specified in the requirements.txt file? Could you post the full output you're getting when running the script?

@tanayz
Copy link
Author

tanayz commented Dec 15, 2015

@sveitser thanks,it seems to be coming from some other direction.I used your requirements.txt after your suggestion and still got this error.Actually I'm trying this program on some other pictures after changing the necessary parameters in config.So seems like it's not version issue.
failed to load CUDNN backend
failed to load CUDAConvNet backend
using CPU backend
{'aug_params': {'allow_stretch': True,
'do_flip': True,
'rotation_range': (0, 360),
'shear_range': (0, 0),
'translation_range': (-40, 40),
'zoom_range': (0.8695652173913044, 1.15)},
'balance_ratio': 0.975,
'balance_weights': array([ 1.36094537, 14.3782235 , 6.63756614, 40.23596793, 49.61299435]),
'batch_size_test': 8,
'batch_size_train': 48,
'final_balance_weights': array([ 1., 2., 2., 2., 2.]),
'h': 448,
'name': 'c_512_4x4_32',
'schedule': {0: 0.003, 150: 0.0003, 220: 3e-05, 251: 'stop'},
'sigma': 0.25,
'test_dir': 'data/test_res',
'train_dir': 'data/train_res',
'w': 448,
'weight_decay': 0.0005}
Traceback (most recent call last):

File "", line 1, in
runfile('/home/tanay/Documents/kaggle_diabetic/train_nn.py', wdir='/home/tanay/Documents/kaggle_diabetic')

File "/home/tanay/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)

File "/home/tanay/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
builtins.execfile(filename, *where)

File "/home/tanay/Documents/kaggle_diabetic/train_nn.py", line 50, in
main()

File "/home/tanay/anaconda/lib/python2.7/site-packages/click/core.py", line 610, in call
return self.main(_args, *_kwargs)

File "/home/tanay/anaconda/lib/python2.7/site-packages/click/core.py", line 590, in main
rv = self.invoke(ctx)

File "/home/tanay/anaconda/lib/python2.7/site-packages/click/core.py", line 782, in invoke
return ctx.invoke(self.callback, **ctx.params)

File "/home/tanay/anaconda/lib/python2.7/site-packages/click/core.py", line 416, in invoke
return callback(_args, *_kwargs)

File "/home/tanay/Documents/Calscan/kaggle_diabetic/train_nn.py", line 41, in main
net.load_params_from(weights_from)

File "/home/tanay/Documents/kaggle_diabetic/src/nolearn-master/nolearn/lasagne/base.py", line 487, in load_params_from
self.initialize()

File "nn.py", line 131, in initialize
out = self._output_layer = self.initialize_layers()

File "/home/tanay/Documents/kaggle_diabetic/src/nolearn-master/nolearn/lasagne/base.py", line 270, in initialize_layers
chain_exception(TypeError(msg), e)

File "/home/tanay/Documents/kaggle_diabetic/src/nolearn-master/nolearn/_compat.py", line 12, in chain_exception
exec("raise exc1, None, sys.exc_info()[2]")

File "/home/tanay/Documents/kaggle_diabetic/src/nolearn-master/nolearn/lasagne/base.py", line 265, in initialize_layers
layer = layer_factory(**layer_kw)

File "/home/tanay/Documents/kaggle_diabetic/src/lasagne-master/lasagne/layers/conv.py", line 375, in init
super(Conv2DLayer, self).init(incoming, **kwargs)

TypeError: Failed to instantiate <class 'lasagne.layers.conv.Conv2DLayer'> with args {'b': <lasagne.init.Constant object at 0x7f1582c81b50>, 'incoming': <lasagne.layers.conv.Conv2DLayer object at 0x7f1582c27ed0>, 'name': 'conv2d2', 'nonlinearity': <lasagne.nonlinearities.LeakyRectify object at 0x7f158274f5d0>, 'filter_size': (4, 4), 'pad': 2, 'W': <lasagne.init.Orthogonal object at 0x7f1582c81b10>, 'num_filters': 32, 'untie_biases': True, 'border_mode': None}.
Maybe parameter names have changed?

@sveitser
Copy link
Owner

The master branch requires a GPU and CuDNN (see the readme). If you'd like to run the code on the CPU the deterministic branch should work.

@tanayz
Copy link
Author

tanayz commented Dec 25, 2015

Will it be possible for you guys to point out what all are the modifications be required to handle lasagne.objectives.Objective deprication.For example I've changed the code in get_objective from

loss = super(RegularizedObjective, self).get_loss(
input=input, target=target, aggregation=aggregation,
deterministic=deterministic, **kwargs)

to
loss = lasagne.objectives.aggregate(
lasagne.objectives.categorical_crossentropy(input, target))

However that doesn't seem to be sufficient.

@sveitser sveitser reopened this Jan 10, 2016
@sveitser
Copy link
Owner

Sorry for the late reply. Have you tried the get_objective function in the deterministic branch?

https://github.com/sveitser/kaggle_diabetic/blob/deterministic/nn.py#L55-L73

@Iammuratc
Copy link

Iammuratc commented Mar 27, 2020

After many years, I have a question regarding dependencies. I hope there is still someone active here. I am trying to run make_kaggle_solution.sh.

I installed the dependencies by using requirements.txt, however, I get an error with numpy
numpy.dtype has the wrong size, try recompiling

The solution for this numpy error is to update the numpy library. However, if I update it, then I get an error with lasagne
File "/blah/blah/kaggle_diabetic_RAM/src/lasagne-dev/lasagne/layers/pool.py", line 6, in <module> from theano.tensor.signal import downsample ImportError: cannot import name downsample

If I update lasagne, theano, nolearn libraries, this is what I am getting...
File "/blah/blah/conda/envs/kaggle/lib/python2.7/site-packages/nolearn/lasagne/base.py", line 700, in fit self.train_loop(X, y, epochs=epochs) TypeError: train_loop() got an unexpected keyword argument epochs

Thank you very much for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants