sandai_kitetsu
sandai_kitetsu

Reputation: 11

theano.function() throws up a long exception in Colab

I am using Google Colab to run the BinaryNet Neural Network implemented using theano by the authors of the original paper here: https://github.com/MatthieuCourbariaux/BinaryNet

When I run the following line from /Train-time/mnist.py (line 199):

train_fn = theano.function([input, target, LR], loss, updates=updates)

Colab throws up this error:

You can find the C code in this temporary file: /tmp/theano_compilation_error_5_e2lq4v library inux-gnu/bits/libc-header-start.h:33, is not found. library inux-gnu/7/include-fixed/limits.h:194, is not found. library inux-gnu/7/include-fixed/syslimits.h:7, is not found. library inux-gnu/7/include-fixed/limits.h:34, is not found. library inux-gnu/bits/mathcalls.h:298:1: is not found. library inux-gnu/bits/mathcalls.h:298:1: is not found. library inux-gnu/bits/libc-header-start.h:33, is not found. library inux-gnu/7/include-fixed/limits.h:194, is not found. library inux-gnu/7/include-fixed/syslimits.h:7, is not found. library inux-gnu/7/include-fixed/limits.h:34, is not found. library inux-gnu/bits/mathcalls.h:298:1: is not found. library inux-gnu/bits/mathcalls.h:298:1: is not found.

Exception: ('The following error happened while compiling the node', Elemwise{Composite{(i0 * (i1 + (i0 * round3(clip(i2, i3, i4)))) * i5)}}[(0, 2)](TensorConstant{(1, 1) of 2.0}, TensorConstant{(1, 1) of -1.0}, Elemwise{Composite{(i0 * (i1 + (i2 * i3 * i4) + i5))}}.0, TensorConstant{(1, 1) of 0}, TensorConstant{(1, 1) of 1}, Elemwise{Composite{Cast{float64}(LT(i0, i1))}}[(0, 0)].0), '\n', "Compilation failed (return status=1): /root/.theano/compiledir_Linux-4.19.104+-x86_64-with-Ubuntu-18.04-bionic-x86_64-3.6.9-64/tmp9q80fef3/mod.cpp:932:2: warning: character constant too long for its type. ['V15_tmp2'] = round(['V15_tmp1']);. ^~~~~~~~~~. /root/.theano/compiledir_Linux-4.19.104+-x86_64-with-Ubuntu-18.04-bionic-x86_64-3.6.9-64/tmp9q80fef3/mod.cpp:932:23: warning: character constant too long for its type. ['V15_tmp2'] = round(['V15_tmp1']);. ^~~~~~~~~~. /root/.theano/compiledir_Linux-4.19.104+-x86_64-with-Ubuntu-18.04-bionic-x86_64-3.6.9-64/tmp9q80fef3/mod.cpp:1054:2: warning: character constant too long for its type. ['V15_tmp2'] = round(['V15_tmp1']);. ^~~~~~~~~~. /root/.theano/compiledir_Linux-4.19.104+-x86_64-with-Ubuntu-18.04-bionic-x86_64-3.6.9-64/tmp9q80fef3/mod.cpp:1054:23: warning: character constant too long for its type. ['V15_tmp2'] = round(['V15_tmp1']);. ^~~~~~~~~~. /root/.theano/compiledir_Linux-4.19.104+-x86_64-with-Ubuntu-18.04-bionic-x86_64-3.6.9-64/tmp9q80fef3/mod.cpp: In member function ‘in...

I used this to install theano and lasagne:

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

I am using the exact same code as in the github repo with the only difference being that I used keras to import the mnist dataset instead of pylearn2

Could someone please help me figure out why this is happening? Thank you!

EDIT

I ran my code in python 2.7 and it worked! This question deals with using python 2 in Colab.

Upvotes: 1

Views: 162

Answers (0)

Related Questions