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

keras 0.2.0 will not work with Theano - Github version #4

Open
CMitropoulos opened this issue Sep 4, 2016 · 5 comments
Open

keras 0.2.0 will not work with Theano - Github version #4

CMitropoulos opened this issue Sep 4, 2016 · 5 comments

Comments

@CMitropoulos
Copy link

downsample module has been moved to the theano.tensor.signal.pool module.")
Warning, cannot import Bidirectional model. You may need to install or use a different version of keras
/usr/local/lib/python3.4/dist-packages/Theano-0.9.0dev2-py3.4.egg/theano/tensor/signal/downsample.py:6: UserWarning: downsample module has been moved to the theano.tensor.signal.pool module.
"downsample module has been moved to the theano.tensor.signal.pool module.")
Warning, cannot import Bidirectional model. You may need to install or use a different version of keras
WARNING:root:Cannot remove /tmp/tmp_ubasbd5 because it is not empty.
/usr/lib/python3.4/unittest/case.py:577: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpusug2512' mode='w' encoding='UTF-8'>
testMethod()
.........................ERROR:root:Cannot find intermediate data 'empirical_weighting'. Looking in :memory:
..ERROR:root:Cannot find intermediate data 'empirical_weighting'. Looking in /tmp/tmpgx3n9_gc
.ERROR:root:Cannot find intermediate data 'empirical_weighting'. Looking in /tmp/tmp6i2aw0ry
.ERROR:root:Cannot find intermediate data 'empirical_weighting'. Looking in /tmp/tmpn89cy223
.ERROR:root:Cannot find intermediate data 'empirical_weighting'. Looking in /tmp/tmptk7qm2ex
........./usr/lib/python3.4/unittest/case.py:577: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmptsrdx4km' mode='w' encoding='UTF-8'>
testMethod()
...s/usr/lib/python3.4/unittest/case.py:577: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmp_1avask8' mode='w' encoding='UTF-8'>
testMethod()
./usr/lib/python3.4/unittest/case.py:577: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpse90wyja' mode='w' encoding='UTF-8'>
testMethod()

.s...........EFFFF..E..EEssE.......

ERROR: test_accuracy (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 729, in test_accuracy
self.assertEqual(0.5, t.train_model_generation())
File "/root/neural_network_cracking/pwd_guess.py", line 1364, in train_model_generation
x_all, y_all, w_all = self.next_train_set_as_np()
File "/root/neural_network_cracking/pwd_guess.py", line 1247, in next_train_set_as_np
y_vec = self.prepare_y_data(y_str_list)
File "/root/neural_network_cracking/pwd_guess.py", line 1258, in prepare_y_data
if keras.version == '0.2.0':
AttributeError: 'module' object has no attribute 'version'

ERROR: test_output_as_np (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 798, in test_output_as_np
t.next_train_set_as_np()
File "/root/neural_network_cracking/pwd_guess.py", line 1247, in next_train_set_as_np
y_vec = self.prepare_y_data(y_str_list)
File "/root/neural_network_cracking/pwd_guess.py", line 1258, in prepare_y_data
if keras.version == '0.2.0':
AttributeError: 'module' object has no attribute 'version'

ERROR: test_tokenize (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 747, in test_tokenize
xv, yv, wv = t.next_train_set_as_np()
File "/root/neural_network_cracking/pwd_guess.py", line 1247, in next_train_set_as_np
y_vec = self.prepare_y_data(y_str_list)
File "/root/neural_network_cracking/pwd_guess.py", line 1258, in prepare_y_data
if keras.version == '0.2.0':
AttributeError: 'module' object has no attribute 'version'

ERROR: test_train_model (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 758, in test_train_model
t.train_model(pwd_guess.ModelSerializer())
File "/root/neural_network_cracking/pwd_guess.py", line 1329, in train_model
accuracy = self.train_model_generation()
File "/root/neural_network_cracking/pwd_guess.py", line 1364, in train_model_generation
x_all, y_all, w_all = self.next_train_set_as_np()
File "/root/neural_network_cracking/pwd_guess.py", line 1247, in next_train_set_as_np
y_vec = self.prepare_y_data(y_str_list)
File "/root/neural_network_cracking/pwd_guess.py", line 1258, in prepare_y_data
if keras.version == '0.2.0':
AttributeError: 'module' object has no attribute 'version'

ERROR: test_train_set_np_two (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 830, in test_train_set_np_two
t.next_train_set_as_np()
File "/root/neural_network_cracking/pwd_guess.py", line 1247, in next_train_set_as_np
y_vec = self.prepare_y_data(y_str_list)
File "/root/neural_network_cracking/pwd_guess.py", line 1258, in prepare_y_data
if keras.version == '0.2.0':
AttributeError: 'module' object has no attribute 'version'

FAIL: test_build_model (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 803, in test_build_model
t.build_model()
File "/root/neural_network_cracking/pwd_guess.py", line 1277, in build_model
go_backwards=self.config.train_backwards))
File "/usr/local/lib/python3.4/dist-packages/Keras-0.2.0-py3.4.egg/keras/layers/recurrent.py", line 510, in init
super(JZS1, self).init(**kwargs)
File "/usr/local/lib/python3.4/dist-packages/Keras-0.2.0-py3.4.egg/keras/layers/core.py", line 23, in init
assert kwarg in {'input_shape'}, "Keyword argument not understood: " + kwarg
AssertionError: Keyword argument not understood: go_backwards

FAIL: test_build_model_bidirectional (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 822, in test_build_model_bidirectional
t.build_model()
File "/root/neural_network_cracking/pwd_guess.py", line 1277, in build_model
go_backwards=self.config.train_backwards))
File "/usr/local/lib/python3.4/dist-packages/Keras-0.2.0-py3.4.egg/keras/layers/recurrent.py", line 510, in init
super(JZS1, self).init(**kwargs)
File "/usr/local/lib/python3.4/dist-packages/Keras-0.2.0-py3.4.egg/keras/layers/core.py", line 23, in init
assert kwarg in {'input_shape'}, "Keyword argument not understood: " + kwarg
AssertionError: Keyword argument not understood: go_backwards

FAIL: test_build_model_deep (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 809, in test_build_model_deep
t.build_model()
File "/root/neural_network_cracking/pwd_guess.py", line 1277, in build_model
go_backwards=self.config.train_backwards))
File "/usr/local/lib/python3.4/dist-packages/Keras-0.2.0-py3.4.egg/keras/layers/recurrent.py", line 510, in init
super(JZS1, self).init(**kwargs)
File "/usr/local/lib/python3.4/dist-packages/Keras-0.2.0-py3.4.egg/keras/layers/core.py", line 23, in init
assert kwarg in {'input_shape'}, "Keyword argument not understood: " + kwarg
AssertionError: Keyword argument not understood: go_backwards

FAIL: test_build_model_deep_no_layers (main.TrainerTest)

Traceback (most recent call last):
File "pwd_guess_unit.py", line 815, in test_build_model_deep_no_layers
t.build_model()
File "/root/neural_network_cracking/pwd_guess.py", line 1277, in build_model
go_backwards=self.config.train_backwards))
File "/usr/local/lib/python3.4/dist-packages/Keras-0.2.0-py3.4.egg/keras/layers/recurrent.py", line 510, in init
super(JZS1, self).init(**kwargs)
File "/usr/local/lib/python3.4/dist-packages/Keras-0.2.0-py3.4.egg/keras/layers/core.py", line 23, in init
assert kwarg in {'input_shape'}, "Keyword argument not understood: " + kwarg
AssertionError: Keyword argument not understood: go_backwards


Ran 156 tests in 24.590s

FAILED (failures=4, errors=5, skipped=6)

@wrmelicher
Copy link
Member

I'm using version 0.2.0 of keras now without these problems. Can you give me more information to go on so I can try to troubleshoot the problem? How did you checkout Keras?

@CMitropoulos
Copy link
Author

So, I managed to solve by changing the Theano version. The version from github wasn't working for me, and I changed it to version 0.7.0 from version 0.9 that is the current in github. In addition I commented out line 1258 " if keras.version == '0.2.0': " since that seemed to cause a problem and I was able to train my network.

Thanks for sharing your work. It is really helpful.

@mdisec
Copy link

mdisec commented Dec 5, 2016

I do getting following error with Keras (0.2.0), Theano (0.8.2) . It seems go_backwards function is compatible with later version of Keras, but not with 0.0.2. Could you please share exactly which version of these libraries you are using ?

2016-12-05 13:28:12,124 INFO: Reading training set...
2016-12-05 13:28:12,127 INFO: Filtered 1 of 499 passwords
2016-12-05 13:28:12,127 INFO: opening Sqlite table 'unnamed' in :memory:
2016-12-05 13:28:12,129 INFO: Rare characters: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T']
2016-12-05 13:28:12,130 INFO: Longest pwd is : 8 characters long
2016-12-05 13:28:12,130 INFO: opening Sqlite table 'unnamed' in :memory:
2016-12-05 13:28:12,131 INFO: opening Sqlite table 'unnamed' in :memory:
2016-12-05 13:28:12,132 INFO: opening Sqlite table 'unnamed' in :memory:
2016-12-05 13:28:12,133 INFO: Done reading passwords...
2016-12-05 13:28:12,133 INFO: Preprocessor type None...
2016-12-05 13:28:12,250 INFO: Regular trainer
2016-12-05 13:28:12,250 INFO: Training model with primary data
2016-12-05 13:28:12,250 INFO: Building model...
2016-12-05 13:28:12,250 CRITICAL: Uncaught exception
Traceback (most recent call last):
  File "pwd_guess.py", line 3219, in <module>
    main_bundle()
  File "pwd_guess.py", line 3215, in <lambda>
    main_bundle = lambda: main(args)
  File "pwd_guess.py", line 3149, in main
    train(args, config)
  File "pwd_guess.py", line 3073, in train
    trainer.train(serializer)
  File "pwd_guess.py", line 1393, in train
    self.build_model()
  File "pwd_guess.py", line 1286, in build_model
    go_backwards=self.config.train_backwards))
  File "/usr/local/lib/python3.4/dist-packages/keras/layers/recurrent.py", line 510, in __init__
    super(JZS1, self).__init__(**kwargs)
  File "/usr/local/lib/python3.4/dist-packages/keras/layers/core.py", line 23, in __init__
    assert kwarg in {'input_shape'}, "Keyword argument not understood: " + kwarg
AssertionError: Keyword argument not understood: go_backwards
Uncaught exception!
 Keyword argument not understood: go_backwards

@wrmelicher
Copy link
Member

@mmetince thanks for letting my know about this. Its currently a todo for me to improve the compatibility with different versions of keras and theano and upgrade it to the new version. I added this to the readme. It would really help if you could let me know if this solves your issue.

  • python packages:

    • theano - Theano requires the version from github instead of the version on
      pip.

      ......

      Make sure that gcc is compatible with nvcc. At the time of writing, gcc
      version 4.9 is required. You can check this by executing:

      which gcc --version

      Theano 0.7.0-0.8.2 was used during development.

      If using 0.8.2, you may need to add the following lines to you .theanorc
      due to Fix for glibc 2.23 Theano/Theano#4369. If you don't you might
      get errors like "WARNING (theano.sandbox.cuda): CUDA is installed, but
      device gpu is not available (error: cuda unavailable)":

      [nvcc]
      flags = -D_FORCE_INLINES

    • keras - at time of writing, the version on pip is not current and will
      cause model saving to fail. Use the version from github instead
      (https://github.com/fchollet/keras). Version 0.2.0 was the main keras
      version during development. However, during development, keras changed to
      version 0.3.1. Some commits support on version or the other. It is
      currently a todo item to improve the state of keras support. On my
      machine the current commit's tests pass with Keras commit
      1e58b895236f6a80f5e07de74af25f16d9cc4625.

@mdisec
Copy link

mdisec commented Dec 5, 2016

@wrmelicher Thank you for your quick response.

I've installed keras with with following command.

pip3 install git+git://github.com/fchollet/keras.git@1e58b895236f6a80f5e07de74af25f16d9cc4625

Now I'm getting following error.

2016-12-05 17:19:13,743 INFO: Version: 211055aa855c6e6f7fcf489717d7d31d669afcca
2016-12-05 17:19:13,743 CRITICAL: Configuration not valid 
2016-12-05 17:19:13,744 CRITICAL: Uncaught exception
Traceback (most recent call last):
  File "pwd_guess.py", line 3219, in <module>
    main_bundle()
  File "pwd_guess.py", line 3215, in <lambda>
    main_bundle = lambda: main(args)
  File "pwd_guess.py", line 3140, in main
    config.validate()
  File "pwd_guess.py", line 924, in validate
    assert self.model_type in model_type_dict
AssertionError
Uncaught exception!

I've tried with both Theano 0.7 and 0.8 but result remained same.

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