ImportError (MidiOutFile)

Solved!
Posted in General by Jason Johnson Sun Aug 02 2015 05:35:19 GMT+0000 (UTC)·12·Viewed 3,204 times

Trying to run the Your First Model tutorial, but I get the error that follows below. I've had to install the most recent stable version of Theano (0.7.0) instead of the bleeding edge one indicated in the install instructions due to some compatibility issues with Python 3.2, in case that could somehow be the root of the problem. Unlike this fellow (http://www.opendeep.org/v0.0.8/discuss/55b3b090a96deb1900990d7e) I haven't figured out the cause, though I'll let you know if I work it out. Running Kali Linux, Python 3.2, Pillow 2.7.0, numpy 1.9.2, and scipy 0.16.0 in addition to the aforementioned theano 0.7.0. Incidentally, thanks for putting this package together. A lot of work goes into something like this. Traceback (most recent call last): File "/home/usrname/PycharmProjects/599/OpenDeepTut.py", line 3, in <module> from opendeep.models.model import Model File "/home/usrname/Downloads/opendeep/opendeep/opendeep/__init__.py", line 26, in <module> from . import data File "/home/usrname/Downloads/opendeep/opendeep/opendeep/data/__init__.py", line 8, in <module> from .standard_datasets import * File "/home/usrname/Downloads/opendeep/opendeep/opendeep/data/standard_datasets/__init__.py", line 4, in <module> from .midi import * File "/home/usrname/Downloads/opendeep/opendeep/opendeep/data/standard_datasets/midi/__init__.py", line 3, in <module> from .jsb_chorales import JSBChorales File "/home/usrname/Downloads/opendeep/opendeep/opendeep/data/standard_datasets/midi/jsb_chorales.py", line 14, in <module> from opendeep.utils.midi import midiread File "/home/usrname/Downloads/opendeep/opendeep/opendeep/utils/midi/__init__.py", line 15, in <module> from MidiOutFile import MidiOutFile ImportError: No module named MidiOutFile
Jason Johnson
Aug 2, 2015

Oddly, importing sys to print out the path seems to have fixed it, allowing others to crop up. Looks like you've already been notified of these here (http://www.opendeep.org/discuss/55b6bda46127b1250036456b) so nothing new here. I just missed that one, sorry. I'll see if I can't patch it up enough to run on my machine.

Jason Johnson
Aug 2, 2015

Importing sys did not fix it, that appears to have been entirely inexplicable now that it's stopped working. Going with the fix provided in the linked post actually did the job, though.

Jason Johnson
Aug 2, 2015

Found two more compatibility issues:

In utils/file_ops.py
import urllib -> import urllib.request as urllib #There are probably cleaner ways to do this

In data/standard_datasets/image/mnist.py
encoding='latin1' #Needs to be added as an argument to each pickle.load() call; this might not actually result in the correct data, but accounts for one of the changes from Python2 to Python3's pickling schemes

I'm now receiving another error, listed below. I can start another thread if you'd like for it, since this one's title is now misleading. This shows up with both the current state of my attempt at following the tutorial, and the copy of the correct version included with the package (many thanks for that, by the way; I'd have been lost without some of the pointers in there from what I assume are more recent versions than the website tutorial has).

Traceback (most recent call last):
File "/home/usrname/PycharmProjects/599/OpenDeepTut.py", line 254, in <module>
optimizer.train()
File "/home/usrname/Downloads/opendeep/opendeep/optimization/optimizer.py", line 331, in train
name='flearn%d' % i)
File "/home/usrname/Downloads/opendeep/opendeep/utils/constructors.py", line 36, in function
return theano.function(args, on_unused_input='warn', *kwargs)
File "/usr/local/lib/python3.2/dist-packages/theano/compile/function.py", line 266, in function
profile=profile)
File "/usr/local/lib/python3.2/dist-packages/theano/compile/pfunc.py", line 489, in pfunc
no_default_updates=no_default_updates)
File "/usr/local/lib/python3.2/dist-packages/theano/compile/pfunc.py", line 237, in rebuild_collect_shared

+ ' of type ' + str(type(v)))

TypeError: Outputs must be theano Variable or Out instances. Received dict_values([]) of type <class 'dict_values'>

Bruno Pajusco
Aug 2, 2015

I seem to have similar issues when using Python3. Looks like the problem has to do with MidiOutFile and I've fixed the pickle load compatibility issue by adding the encoding flag and setting it to 'latin-1'. Here is the full traceback for completeness:


ImportError Traceback (most recent call last)

<ipython-input-1-56beae525b02> in <module>()
6 import theano
7 # internal references
----> 8 from opendeep.data import MNIST
9 from opendeep.log import config_root_logger
10 from opendeep.models import Model, RNN, GSN

/home/bruno/anaconda/pkgs/opendeep/opendeep/init.py in <module>()
24
25 # internal imports for easy package structure
---> 26 from . import data
27 from . import log
28 from . import data

/home/bruno/anaconda/pkgs/opendeep/opendeep/data/init.py in <module>()
6 from .dataset_memory import
7 # to get premade datasets
----> 8 from .standard_datasets import

9
10 # for streams

/home/bruno/anaconda/pkgs/opendeep/opendeep/data/standard_datasets/init.py in <module>()
2
3 from .image import
----> 4 from .midi import

/home/bruno/anaconda/pkgs/opendeep/opendeep/data/standard_datasets/midi/init.py in <module>()
1 from future import division, absolute_import, print_function
2
----> 3 from .jsb_chorales import JSBChorales
4 from .musedata import MuseData
5 from .nottingham import Nottingham

/home/bruno/anaconda/pkgs/opendeep/opendeep/data/standard_datasets/midi/jsb_chorales.py in <module>()
12 from opendeep.data.dataset_file import FileDataset
13 from opendeep.utils.file_ops import find_files
---> 14 from opendeep.utils.midi import midiread
15 from opendeep.utils.decorators import inherit_docs
16

/home/bruno/anaconda/pkgs/opendeep/opendeep/utils/midi/init.py in <module>()
13
14
---> 15 from MidiOutFile import MidiOutFile
16 from MidiInFile import MidiInFile
17 from MidiOutStream import MidiOutStream

ImportError: No module named 'MidiOutFile'

Markus Beissinger
Aug 2, 2015

Hmm I'm going to look at and fix this today. Sorry about all the python 3 bugs!

Jason Johnson
Aug 2, 2015

Thanks. I'm just glad you're even bothering to work on python 3 support. It's an extra burden on time and energy that you didn't necessarily need to take on, but it helps a lot.

Markus Beissinger
Aug 3, 2015

Import errors should be fixed now!


Markus Beissinger marked this as solved
Bruno Pajusco
Aug 3, 2015

I'm afraid to report that it throws another exception, different this time but still not fully happy. By the way, thanks for providing all this support as it's really encouraging me to try out your tools! Here's the trace back for completion.


ImportError Traceback (most recent call last)

<ipython-input-1-56beae525b02> in <module>()
6 import theano
7 # internal references
----> 8 from opendeep.data import MNIST
9 from opendeep.log import config_root_logger
10 from opendeep.models import Model, RNN, GSN

/home/bruno/anaconda/pkgs/opendeep/opendeep/init.py in <module>()
24
25 # internal imports for easy package structure
---> 26 from . import data
27 from . import log
28 from . import data

/home/bruno/anaconda/pkgs/opendeep/opendeep/data/init.py in <module>()
6 from .dataset_memory import
7 # to get premade datasets
----> 8 from .standard_datasets import

9
10 # for streams

/home/bruno/anaconda/pkgs/opendeep/opendeep/data/standard_datasets/init.py in <module>()
2
3 from .image import
----> 4 from .midi import

/home/bruno/anaconda/pkgs/opendeep/opendeep/data/standard_datasets/midi/init.py in <module>()
1 from future import division, absolute_import, print_function
2
----> 3 from .jsb_chorales import JSBChorales
4 from .musedata import MuseData
5 from .nottingham import Nottingham

/home/bruno/anaconda/pkgs/opendeep/opendeep/data/standard_datasets/midi/jsb_chorales.py in <module>()
12 from opendeep.data.dataset_file import FileDataset
13 from opendeep.utils.file_ops import find_files
---> 14 from opendeep.utils.midi import midiread
15 from opendeep.utils.decorators import inherit_docs
16

/home/bruno/anaconda/pkgs/opendeep/opendeep/utils/midi/init.py in <module>()
9
10
---> 11 from .MidiOutFile import MidiOutFile
12 from .MidiInFile import MidiInFile
13 from .MidiOutStream import MidiOutStream

/home/bruno/anaconda/pkgs/opendeep/opendeep/utils/midi/MidiOutFile.py in <module>()
2 from future import absolute_import
3 from .MidiOutStream import MidiOutStream
----> 4 from .RawOutstreamFile import RawOutstreamFile
5
6 from .constants import *

/home/bruno/anaconda/pkgs/opendeep/opendeep/utils/midi/RawOutstreamFile.py in <module>()
4 from future import absolute_import
5 import sys
----> 6 from types import StringType
7 from struct import unpack
8 from cStringIO import StringIO

ImportError: cannot import name 'StringType'

Markus Beissinger
Aug 3, 2015

Thanks for the heads up - it should be fixed now. Let me know if you run into more problems!

Jason Johnson
Aug 5, 2015

That's fixed it! Essentially, anyway. I found one more error, but it was simple enough for me to solve on my own:

in misc.py
in min_normalized_izip()
for elems in itertools.izip(iterables): -> for elems in zip(iterables):

Hopefully the notation there is readable. Anyway, I've got the tutorial training going. While I wait for my new GPU to ship, I'm constrained to running on CPU, so it'll take a little bit, but it at least got that far. I'll let you know if I see any other errors. Thanks again for all the work you're putting into this!

Bruno Pajusco
Aug 5, 2015

Unfortunately I can't quite say the same for myself as I run into another issue. Looks like MidiOutFile importing works fine now but I have a problem in training the RNN-GSN in your tutorial. Looks like a Theano exception that returns a Type error: index must be integers and I don't know enough about the code to understand what went wrong, beside the obvious conclusion that the code is looking for an integer for indexing into the tensor. I attach full model output (including debugging statements) with the traceback as it might help you figure out what is going wrong.

2015-08-05 08:21:49,525 - opendeep.models.model - INFO - Creating a new instance of <class '__main__.RNN_GSN'>
2015-08-05 08:21:49,543 - opendeep.models.model - WARNING - No input_size or inputs_hook! Make sure this is done in a Container. Setting input_size=1 for the Container now...
2015-08-05 08:21:49,545 - opendeep.models.model - WARNING - No output_size given! Make sure this is from a generative model (where output_size is the same as input_size. Setting output_size=input_size now...
2015-08-05 08:21:49,546 - opendeep.models.model - INFO - <class '__main__.RNN_GSN'> self.args: {'input_size': 1, 'output_size': 1, 'outdir': None}
2015-08-05 08:21:49,547 - opendeep.models.model - INFO - Creating a new instance of <class 'opendeep.models.multi_layer.recurrent.RNN'>
2015-08-05 08:21:49,550 - opendeep.utils.file_ops - DEBUG - Making directory /home/bruno/Documents/Machine_Learning/intro_deep/outputs/rnn
2015-08-05 08:21:49,552 - opendeep.utils.file_ops - DEBUG - Directory /home/bruno/Documents/Machine_Learning/intro_deep/outputs/rnn already exists!
2015-08-05 08:21:49,553 - opendeep.models.model - INFO - <class 'opendeep.models.multi_layer.recurrent.RNN'> self.args: {'r_weights_std': 0.005, 'weights_interval': 'montreal', 'r_weights_mean': 0, 'cost_function': 'mse', 'outdir': 'outputs/rnn/', 'noise_decay': False, 'r_weights_interval': 'montreal', 'bias_init': 0.0, 'output_size': 500, 'r_bias_init': 0.0, 'clip_recurrent_grads': False, 'hidden_activation': 'relu', 'weights_init': 'uniform', 'input_size': 784, 'class': <class 'opendeep.models.multi_layer.recurrent.RNN'>, 'weights_mean': 0, 'mrg': <theano.sandbox.rng_mrg.MRG_RandomStreams object at 0x7fc4b4315320>, 'noise_decay_amount': 0.99, 'cost_args': None, 'layers': 1, 'noise_level': None, 'r_weights_init': 'identity', 'activation': 'tanh', 'direction': 'forward', 'weights_std': 0.005, 'noise': 'dropout', 'hidden_size': 100}
2015-08-05 08:21:49,581 - opendeep.models.model - DEBUG - Saving <class 'opendeep.models.multi_layer.recurrent.RNN'> configuration to /home/bruno/Documents/Machine_Learning/intro_deep/outputs/rnn/rnn_config.pkl
2015-08-05 08:21:49,583 - opendeep.models.multi_layer.recurrent - DEBUG - Adding dropout noise switch.
2015-08-05 08:21:49,799 - opendeep.utils.nnet - DEBUG - Creating weights with shape (784, 100) from Uniform distribution with formula name: montreal
2015-08-05 08:21:49,804 - opendeep.utils.nnet - DEBUG - Creating weights with shape (100, 500) from Uniform distribution with formula name: montreal
2015-08-05 08:21:49,807 - opendeep.utils.nnet - DEBUG - Initializing bias variable with shape (100,)
2015-08-05 08:21:49,808 - opendeep.utils.nnet - DEBUG - Initializing bias variable with shape (500,)
2015-08-05 08:21:49,963 - opendeep.models.multi_layer.recurrent - DEBUG - Updating hidden layer 1
2015-08-05 08:21:55,220 - opendeep.models.multi_layer.recurrent - INFO - Initialized a forward RNN!
2015-08-05 08:21:55,221 - opendeep.models.model - INFO - Creating a new instance of <class 'opendeep.models.multi_layer.generative_stochastic_network.GSN'>
2015-08-05 08:21:55,222 - opendeep.models.model - WARNING - No output_size given! Make sure this is from a generative model (where output_size is the same as input_size. Setting output_size=input_size now...
2015-08-05 08:21:55,223 - opendeep.utils.file_ops - DEBUG - Making directory /home/bruno/Documents/Machine_Learning/intro_deep/outputs/gsn
2015-08-05 08:21:55,240 - opendeep.models.model - INFO - <class 'opendeep.models.multi_layer.generative_stochastic_network.GSN'> self.args: {'weights_interval': 'montreal', 'tied_weights': True, 'input_noise': 'salt_and_pepper', 'outdir': 'outputs/gsn/', 'noise_decay': 'exponential', 'output_size': 784, 'bias_init': 0.0, 'hidden_activation': 'tanh', 'noise_annealing': 1, 'image_height': 28, 'hidden_noise': 'gaussian', 'image_width': 28, 'class': <class 'opendeep.models.multi_layer.generative_stochastic_network.GSN'>, 'input_size': 784, 'weights_init': 'uniform', 'weights_mean': 0, 'add_noise': True, 'mrg': <theano.sandbox.rng_mrg.MRG_RandomStreams object at 0x7fc4b4387f98>, 'noiseless_h1': True, 'input_noise_level': 0.4, 'cost_args': None, 'visible_activation': 'sigmoid', 'layers': 2, 'hidden_noise_level': 2, 'walkbacks': 4, 'cost_function': 'binary_crossentropy', 'weights_std': 0.005, 'input_sampling': True, 'hidden_size': 500}
2015-08-05 08:21:55,240 - opendeep.models.model - DEBUG - Saving <class 'opendeep.models.multi_layer.generative_stochastic_network.GSN'> configuration to /home/bruno/Documents/Machine_Learning/intro_deep/outputs/gsn/gsn_config.pkl
2015-08-05 08:21:55,242 - opendeep.utils.nnet - DEBUG - Creating weights with shape (784, 500) from Uniform distribution with formula name: montreal
2015-08-05 08:21:59,418 - opendeep.utils.nnet - DEBUG - Creating weights with shape (500, 500) from Uniform distribution with formula name: montreal
2015-08-05 08:21:59,626 - opendeep.utils.nnet - DEBUG - Initializing bias variable with shape (784,)
2015-08-05 08:21:59,627 - opendeep.utils.nnet - DEBUG - Initializing bias variable with shape (500,)
2015-08-05 08:21:59,628 - opendeep.utils.nnet - DEBUG - Initializing bias variable with shape (500,)
2015-08-05 08:21:59,629 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - gsn params: [W_0_1, W_1_2, b_0, b_1, b_2]
2015-08-05 08:21:59,629 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Building GSN graphs...
2015-08-05 08:21:59,805 - opendeep.models.multi_layer.generative_stochastic_network - INFO - Building the GSN graph : 4 updates
2015-08-05 08:21:59,806 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN Walkback 1/4
2015-08-05 08:21:59,806 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:21:59,807 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:21:59,807 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:21:59,809 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:21:59,809 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:21:59,812 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:21:59,813 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:21:59,813 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:21:59,814 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:21:59,815 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:00,078 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:00,079 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:00,080 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding pre-activation gaussian noise for layer 2
2015-08-05 08:22:00,080 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:00,183 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:00,184 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding post-activation gaussian noise for layer 2
2015-08-05 08:22:00,185 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:00,285 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:00,286 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN Walkback 2/4
2015-08-05 08:22:00,286 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:22:00,287 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:22:00,287 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:22:00,288 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:22:00,289 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:22:00,290 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:22:00,290 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:22:00,291 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:22:00,292 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:22:00,292 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:00,566 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:00,566 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:00,567 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding pre-activation gaussian noise for layer 2
2015-08-05 08:22:00,568 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:00,670 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:00,671 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding post-activation gaussian noise for layer 2
2015-08-05 08:22:00,671 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:00,773 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:00,774 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN Walkback 3/4
2015-08-05 08:22:00,775 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:22:00,775 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:22:00,776 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:22:00,777 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:22:00,778 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:22:00,778 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:22:00,779 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:22:00,779 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:22:00,780 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:22:00,781 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:01,050 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:01,050 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:01,051 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding pre-activation gaussian noise for layer 2
2015-08-05 08:22:01,052 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:01,155 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:01,156 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding post-activation gaussian noise for layer 2
2015-08-05 08:22:01,157 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:01,254 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:01,255 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN Walkback 4/4
2015-08-05 08:22:01,255 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:22:01,256 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:22:01,256 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:22:01,258 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:22:01,258 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:22:01,259 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:22:01,260 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:22:01,260 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:22:01,261 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:22:01,262 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:01,541 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:01,542 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:01,543 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding pre-activation gaussian noise for layer 2
2015-08-05 08:22:01,543 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:01,644 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:01,645 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding post-activation gaussian noise for layer 2
2015-08-05 08:22:01,646 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:01,745 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:01,747 - opendeep.models.multi_layer.generative_stochastic_network - INFO - Building the GSN graph : 4 updates
2015-08-05 08:22:01,748 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN Walkback 1/4
2015-08-05 08:22:01,749 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:22:01,749 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:22:01,750 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:22:01,751 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:22:01,751 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:22:01,752 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:22:01,753 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:22:01,753 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:22:01,754 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:22:01,755 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:02,034 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:02,035 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:02,036 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:02,037 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:02,038 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN Walkback 2/4
2015-08-05 08:22:02,038 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:22:02,038 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:22:02,039 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:22:02,040 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:22:02,041 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:22:02,041 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:22:02,042 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:22:02,042 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:22:02,043 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:22:02,044 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:02,324 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:02,326 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:02,327 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:02,329 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:02,330 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN Walkback 3/4
2015-08-05 08:22:02,331 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:22:02,332 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:22:02,333 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:22:02,335 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:22:02,336 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:22:02,337 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:22:02,338 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:22:02,339 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:22:02,341 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:22:02,343 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:02,633 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:02,634 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:02,636 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:02,637 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:02,638 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN Walkback 4/4
2015-08-05 08:22:02,639 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:22:02,640 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:22:02,641 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:22:02,643 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:22:02,644 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:22:02,645 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:22:02,646 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:22:02,647 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:22:02,649 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:22:02,650 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:02,931 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:02,933 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:02,934 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:02,934 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:02,935 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Cost w.r.t p(X|...) at every step in the graph for the GSN
2015-08-05 08:22:03,023 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Performing one walkback in network state sampling.
2015-08-05 08:22:03,024 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - odd layer updates
2015-08-05 08:22:03,024 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 1
2015-08-05 08:22:03,025 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1 and W_1_2.T
2015-08-05 08:22:03,026 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - >>NO noise in first hidden layer
2015-08-05 08:22:03,027 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 1
2015-08-05 08:22:03,028 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - even layer updates
2015-08-05 08:22:03,028 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 0
2015-08-05 08:22:03,029 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_0_1.T
2015-08-05 08:22:03,030 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Activation for visible layer
2015-08-05 08:22:03,031 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Sampling from input
2015-08-05 08:22:03,322 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - updating layer 2
2015-08-05 08:22:03,323 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - using W_1_2
2015-08-05 08:22:03,325 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding pre-activation gaussian noise for layer 2
2015-08-05 08:22:03,326 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:03,428 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Hidden units activation for layer 2
2015-08-05 08:22:03,430 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Adding post-activation gaussian noise for layer 2
2015-08-05 08:22:03,431 - opendeep.utils.noise - DEBUG - Adding Gaussian noise with std: <TensorType(float64, scalar)>
2015-08-05 08:22:03,535 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - done full update.
2015-08-05 08:22:03,536 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - Compiling functions...
2015-08-05 08:22:03,537 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - f_run...
2015-08-05 08:22:08,006 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - f_noise...
2015-08-05 08:22:09,396 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - f_sample...

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/scan_module/scan.py:1017: Warning: In the strict mode, all neccessary shared variables must be passed as a part of non_sequences
'must be passed as a part of non_sequences', Warning)
/home/bruno/anaconda/pkgs/opendeep/opendeep/utils/constructors.py:36: UserWarning: theano.function was asked to create a function computing outputs given certain inputs, but the provided input variable at index 1 is not part of the computational graph needed to compute the outputs: H_sampling_1.
To make this warning into an error, you can pass the parameter on_unused_input='raise' to theano.function. To disable it completely, use on_unused_input='ignore'.
return theano.function(args, on_unused_input='warn', *kwargs)

2015-08-05 08:22:19,167 - opendeep.models.multi_layer.generative_stochastic_network - DEBUG - GSN compiling done. Took 15.62929 seconds
2015-08-05 08:22:19,172 - opendeep.models.model - INFO - Creating a new instance of <class 'opendeep.models.multi_layer.generative_stochastic_network.GSN'>
2015-08-05 08:22:19,173 - opendeep.models.model - WARNING - No output_size given! Make sure this is from a generative model (where output_size is the same as input_size. Setting output_size=input_size now...
2015-08-05 08:22:19,174 - opendeep.utils.file_ops - DEBUG - Making directory /home/bruno/Documents/Machine_Learning/intro_deep/outputs/gsn
2015-08-05 08:22:19,174 - opendeep.utils.file_ops - DEBUG - Directory /home/bruno/Documents/Machine_Learning/intro_deep/outputs/gsn already exists!
2015-08-05 08:22:19,175 - opendeep.models.model - INFO - <class 'opendeep.models.multi_layer.generative_stochastic_network.GSN'> self.args: {'weights_interval': 'montreal', 'tied_weights': True, 'input_noise': 'salt_and_pepper', 'outdir': 'outputs/gsn/', 'noise_decay': 'exponential', 'input_size': 784, 'bias_init': 0.0, 'hidden_activation': 'tanh', 'noise_annealing': 1, 'image_height': 28, 'hidden_noise': 'gaussian', 'image_width': 28, 'class': <class 'opendeep.models.multi_layer.generative_stochastic_network.GSN'>, 'output_size': 784, 'weights_init': 'uniform', 'weights_mean': 0, 'add_noise': True, 'mrg': <theano.sandbox.rng_mrg.MRG_RandomStreams object at 0x7fc4b4387f98>, 'noiseless_h1': True, 'input_noise_level': 0.4, 'cost_args': None, 'visible_activation': 'sigmoid', 'layers': 2, 'hidden_noise_level': 2, 'walkbacks': 4, 'cost_function': 'binary_crossentropy', 'weights_std': 0.005, 'input_sampling': True, 'hidden_size': 500}
2015-08-05 08:22:19,175 - opendeep.models.model - DEBUG - Saving <class 'opendeep.models.multi_layer.generative_stochastic_network.GSN'> configuration to /home/bruno/Documents/Machine_Learning/intro_deep/outputs/gsn/gsn_config.pkl


TypeError Traceback (most recent call last)

<ipython-input-3-5eba8b269c3b> in <module>()
1 # Now we can instantiate and train the model!
----> 2 rnn_gsn = RNN_GSN()
3
4 # data! (needs to be 3d for rnn).
5 mnist = MNIST(sequence_number=1, seq_3d=True, seq_length=30)

<ipython-input-2-bfb7e305cafa> in init(self)
52 fn=lambda h, x: step(h, x),
53 sequences=[self.rnn.output, self.rnn.input],
---> 54 outputs_info=[None, None]
55 )
56

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/scan_module/scan.py in scan(fn, sequences, outputs_info, non_sequences, n_steps, truncate_gradient, go_backwards, mode, name, profile, allow_gc, strict)
743 # and outputs that needs to be separated
744
--> 745 condition, outputs, updates = scan_utils.get_updates_and_outputs(fn(*args))
746 if condition is not None:
747 as_while = True

<ipython-input-2-bfb7e305cafa> in <lambda>(h, x)
50
51 (outputs, costs), scan_updates = theano.scan(
---> 52 fn=lambda h, x: step(h, x),
53 sequences=[self.rnn.output, self.rnn.input],
54 outputs_info=[None, None]

<ipython-input-2-bfb7e305cafa> in step(hiddens, x)
44 hiddens_hook=(gsn_hiddens, hiddens),
45 params_hook=(gsn_params),
---> 46 **gsn_args
47 )
48 # return the reconstruction and cost!

/home/bruno/anaconda/pkgs/opendeep/opendeep/models/multi_layer/generative_stochastic_network.py in init(self, inputs_hook, hiddens_hook, params_hook, outdir, input_size, hidden_size, layers, walkbacks, visible_activation, hidden_activation, input_sampling, mrg, tied_weights, weights_init, weights_interval, weights_mean, weights_std, bias_init, cost_function, cost_args, add_noise, noiseless_h1, hidden_noise, hidden_noise_level, input_noise, input_noise_level, noise_decay, noise_annealing, image_width, image_height, **kwargs)
245
246 if self.hiddens_hook is not None:
--> 247 self.hiddens = self.unpack_hiddens(self.hiddens_hook[1])
248
249 #########################

/home/bruno/anaconda/pkgs/opendeep/opendeep/models/multi_layer/generative_stochastic_network.py in unpack_hiddens(self, hiddens_tensor)
733 else:
734 h_list.append(
--> 735 (hiddens_tensor.T[(idx/2)self.layer_sizes[idx] : (idx/2 + 1)self.layer_sizes[idx+1]]).T
736 )
737

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/tensor/var.py in getitem(self, args)
393 return self.take(args[axis], axis)
394 else:
--> 395 return theano.tensor.subtensor.advanced_subtensor(self, *args)
396 else:
397 if numpy.newaxis in args:

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/gof/op.py in call(self, inputs, **kwargs)
505 """
506 return_list = kwargs.pop('return_list', False)
--> 507 node = self.make_node(
inputs, **kwargs)
508
509 if config.compute_test_value != 'off':

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/tensor/subtensor.py in make_node(self, x, *index)
2053 x = theano.tensor.as_tensor_variable(x)
2054
-> 2055 index = tuple(map(as_index_variable, index))
2056 bcast = adv_index_broadcastable_pattern(x, index)
2057 return gof.Apply(self,

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/tensor/subtensor.py in as_index_variable(idx)
1992 return NoneConst.clone()
1993 if isinstance(idx, slice):
-> 1994 return make_slice(idx)
1995 if isinstance(idx, gof.Variable) and isinstance(idx.type, SliceType):
1996 return idx

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/gof/op.py in call(self, inputs, **kwargs)
505 """
506 return_list = kwargs.pop('return_list', False)
--> 507 node = self.make_node(
inputs, **kwargs)
508
509 if config.compute_test_value != 'off':

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/tensor/type_other.py in make_node(self, slc, stop, step)
33 inp = [slc, stop, step]
34 return Apply(self,
---> 35 list(map(as_int_none_variable, inp)),
36 [slicetype()])
37

/home/bruno/anaconda/envs/py3k/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/tensor/type_other.py in as_int_none_variable(x)
17 x = theano.tensor.as_tensor_variable(x, ndim=0)
18 if x.type.dtype[:3] not in ('int', 'uin'):
---> 19 raise TypeError('index must be integers')
20 return x
21

TypeError: index must be integers

Markus Beissinger
Aug 5, 2015

Ah that error had to do with the division change from 2 to 3 - should be fixed now!

Markdown is allowed