Problem running the example code in 32-bit OS
ewan1983 opened this issue · 0 comments
First and foremost, THANK YOU for this AWESOME LSTM lib!!
I am new to all of these, RNN, Theano, and even Python, so please forgive my ignorant question:
I download the Tutorial.ipynb, and run it line by line, however it stuck at:
# construct model & theano functions:
model = Model(
input_size=10,
hidden_size=10,
vocab_size=len(vocab),
stack_size=1, # make this bigger, but makes compilation slow
celltype=RNN # use RNN or LSTM
)
model.stop_on(vocab.word2index["."])
where the error message is:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-13e620ce56bd> in <module>()
5 vocab_size=len(vocab),
6 stack_size=1, # make this bigger, but makes compilation slow
----> 7 celltype=RNN # use RNN or LSTM
8 )
9 model.stop_on(vocab.word2index["."])
<ipython-input-8-398b63091e52> in __init__(self, hidden_size, input_size, vocab_size, stack_size, celltype)
62 self.srng = T.shared_randomstreams.RandomStreams(np.random.randint(0, 1024))
63 # create symbolic variables for prediction:
---> 64 self.predictions = self.create_prediction()
65 # create symbolic variable for greedy search:
66 self.greedy_predictions = self.create_prediction(greedy=True)
<ipython-input-8-398b63091e52> in create_prediction(self, greedy)
107 outputs_info=outputs_info)
108 else:
--> 109 outputs_info = [initial_state_with_taps(layer, num_examples) for layer in self.model.layers[1:]]
110 result, _ = theano.scan(fn=step,
111 sequences=[inputs.T],
<ipython-input-8-398b63091e52> in initial_state_with_taps(layer, dimensions)
34 def initial_state_with_taps(layer, dimensions = None):
35 """Optionally wrap tensor variable into a dict with taps=[-1]"""
---> 36 state = initial_state(layer, dimensions)
37 if state is not None:
38 return dict(initial=state, taps=[-1])
<ipython-input-8-398b63091e52> in initial_state(layer, dimensions)
30 return layer.initial_hidden_state if has_hidden(layer) else None
31 else:
---> 32 return matrixify(layer.initial_hidden_state, dimensions) if has_hidden(layer) else None
33
34 def initial_state_with_taps(layer, dimensions = None):
<ipython-input-8-398b63091e52> in matrixify(vector, n)
18
19 def matrixify(vector, n):
---> 20 return T.repeat(T.shape_padleft(vector), n, axis=0)
21
22 def initial_state(layer, dimensions = None):
C:\Anaconda\lib\site-packages\theano\tensor\extra_ops.pyc in repeat(x, repeats, axis)
358 .. versionadded:: 0.6
359 """
--> 360 return RepeatOp(axis=axis)(x, repeats)
361
362
C:\Anaconda\lib\site-packages\theano\gof\op.pyc in __call__(self, *inputs, **kwargs)
397 """
398 return_list = kwargs.pop('return_list', False)
--> 399 node = self.make_node(*inputs, **kwargs)
400 if self.add_stack_trace_on_call:
401 self.add_tag_trace(node)
C:\Anaconda\lib\site-packages\theano\tensor\extra_ops.pyc in make_node(self, x, repeats)
257 ("dtypes %s are not supported by numpy.repeat "
258 "for the 'repeats' parameter, "
--> 259 % numpy_unsupported_dtypes), repeats.dtype)
260
261 if self.axis is None:
TypeError: not all arguments converted during string formatting
EDIT 1:
In the beginning, I thought maybe my Theano 0.6.0 is a bit old, so I update it to 0.7.0, but the error remains.
EDIT 2:
I fixed the syntax typo and got the real error message:
TypeError: ("dtypes ('uint32', 'int64', 'uint64') are not supported by numpy.repeat for the 'repeats' parameter, ", 'int64')
And then I notice:
ptr_bitwidth = theano.gof.local_bitwidth()
if ptr_bitwidth == 64:
numpy_unsupported_dtypes = ('uint64',)
if ptr_bitwidth == 32:
numpy_unsupported_dtypes = ('uint32', 'int64', 'uint64')
It is because I use 32 bit OS, the somehow default int64 type is not supported,
So you guys with 64 bit OS shouldn't have experienced this problem.
EDIT 3:
So I tried to force cast the type to get over this error:
num_examples = T.cast(num_examples, 'int32')
Then I just got blown over by a huge load of error and warnings
WARNING (theano.gof.compilelock): Overriding existing lock by dead process '4952' (I am process '4684')
WARNING:theano.gof.compilelock:Overriding existing lock by dead process '4952' (I am process '4684')
C:\Anaconda\lib\site-packages\theano\scan_module\scan_perform_ext.py:133: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility
from scan_perform.scan_perform import *
ERROR (theano.gof.opt): Optimization failure due to: local_argmax_pushdown
ERROR:theano.gof.opt:Optimization failure due to: local_argmax_pushdown
ERROR (theano.gof.opt): TRACEBACK:
ERROR:theano.gof.opt:TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\theano\gof\opt.py", line 1493, in process_node
replacements = lopt.transform(node)
File "C:\Anaconda\lib\site-packages\theano\tensor\nnet\nnet.py", line 1448, in local_argmax_pushdown
return tensor._max_and_argmax(pre_x, axis)
File "C:\Anaconda\lib\site-packages\theano\gof\op.py", line 507, in __call__
node = self.make_node(*inputs, **kwargs)
File "C:\Anaconda\lib\site-packages\theano\tensor\basic.py", line 1252, in make_node
raise TypeError("MaxAndArgmax needs a constant axis")
TypeError: MaxAndArgmax needs a constant axis
ERROR:theano.gof.opt:Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\theano\gof\opt.py", line 1493, in process_node
replacements = lopt.transform(node)
File "C:\Anaconda\lib\site-packages\theano\tensor\nnet\nnet.py", line 1448, in local_argmax_pushdown
return tensor._max_and_argmax(pre_x, axis)
File "C:\Anaconda\lib\site-packages\theano\gof\op.py", line 507, in __call__
node = self.make_node(*inputs, **kwargs)
File "C:\Anaconda\lib\site-packages\theano\tensor\basic.py", line 1252, in make_node
raise TypeError("MaxAndArgmax needs a constant axis")
TypeError: MaxAndArgmax needs a constant axis
ERROR (theano.gof.opt): Optimization failure due to: local_argmax_pushdown
ERROR:theano.gof.opt:Optimization failure due to: local_argmax_pushdown
ERROR (theano.gof.opt): TRACEBACK:
ERROR:theano.gof.opt:TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\theano\gof\opt.py", line 1493, in process_node
replacements = lopt.transform(node)
File "C:\Anaconda\lib\site-packages\theano\tensor\nnet\nnet.py", line 1454, in local_argmax_pushdown
('x', 0))(pre_bias), axis)
File "C:\Anaconda\lib\site-packages\theano\gof\op.py", line 507, in __call__
node = self.make_node(*inputs, **kwargs)
File "C:\Anaconda\lib\site-packages\theano\tensor\basic.py", line 1252, in make_node
raise TypeError("MaxAndArgmax needs a constant axis")
TypeError: MaxAndArgmax needs a constant axis
ERROR:theano.gof.opt:Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\theano\gof\opt.py", line 1493, in process_node
replacements = lopt.transform(node)
File "C:\Anaconda\lib\site-packages\theano\tensor\nnet\nnet.py", line 1454, in local_argmax_pushdown
('x', 0))(pre_bias), axis)
File "C:\Anaconda\lib\site-packages\theano\gof\op.py", line 507, in __call__
node = self.make_node(*inputs, **kwargs)
File "C:\Anaconda\lib\site-packages\theano\tensor\basic.py", line 1252, in make_node
raise TypeError("MaxAndArgmax needs a constant axis")
TypeError: MaxAndArgmax needs a constant axis
ERROR (theano.gof.opt): Optimization failure due to: local_argmax_pushdown
ERROR:theano.gof.opt:Optimization failure due to: local_argmax_pushdown
ERROR (theano.gof.opt): TRACEBACK:
ERROR:theano.gof.opt:TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\theano\gof\opt.py", line 1493, in process_node
replacements = lopt.transform(node)
File "C:\Anaconda\lib\site-packages\theano\tensor\nnet\nnet.py", line 1454, in local_argmax_pushdown
('x', 0))(pre_bias), axis)
File "C:\Anaconda\lib\site-packages\theano\gof\op.py", line 507, in __call__
node = self.make_node(*inputs, **kwargs)
File "C:\Anaconda\lib\site-packages\theano\tensor\basic.py", line 1252, in make_node
raise TypeError("MaxAndArgmax needs a constant axis")
TypeError: MaxAndArgmax needs a constant axis
ERROR:theano.gof.opt:Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\theano\gof\opt.py", line 1493, in process_node
replacements = lopt.transform(node)
File "C:\Anaconda\lib\site-packages\theano\tensor\nnet\nnet.py", line 1454, in local_argmax_pushdown
('x', 0))(pre_bias), axis)
File "C:\Anaconda\lib\site-packages\theano\gof\op.py", line 507, in __call__
node = self.make_node(*inputs, **kwargs)
File "C:\Anaconda\lib\site-packages\theano\tensor\basic.py", line 1252, in make_node
raise TypeError("MaxAndArgmax needs a constant axis")
TypeError: MaxAndArgmax needs a constant axis
EDIT4
Just found out the new errors are similar to issue12, which mentioned the error have something to do with scipy. So update it
scipy: 0.15.1-np19py27_0 --> 0.16.0-np19py27_0
Run the example code again, and the error remains. Still stuck. Frustrating.
These bugs are really newbie unfriendly, Last time I use pandas and got stuck with some pytable bugs, spend way too much time trying to develop walk-around. I don't want to spend time fighting the tools, I just want to get them up and running FAST so I can do my actual work.