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

Error in running imdb_lm_gcnn.py #2

Open
kfmn opened this issue Jan 12, 2017 · 3 comments
Open

Error in running imdb_lm_gcnn.py #2

kfmn opened this issue Jan 12, 2017 · 3 comments

Comments

@kfmn
Copy link

kfmn commented Jan 12, 2017

Hi,

I'm trying to run imdb_lm_gcnn.py to test your demo.
I use keras 1.2.0 with tensorflow 0.10.0 on ubuntu 14.04
But I got the following error log:

/usr/local/lib/python3.4/dist-packages/keras/engine/topology.py:368: UserWarning: The regularizers property of layers/models is deprecated. Regularization losses are now managed via the losses layer/model property.
warnings.warn('The regularizers property of '
Traceback (most recent call last):
File "imdb_lm_gcnn.py", line 69, in
run_demo()
File "imdb_lm_gcnn.py", line 65, in run_demo
train_model()
File "imdb_lm_gcnn.py", line 43, in train_model
loss='sparse_categorical_crossentropy')
File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 619, in compile
sample_weight, mask)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 307, in weighted
score_array = fn(y_true, y_pred)
File "/usr/local/lib/python3.4/dist-packages/keras/objectives.py", line 45, in sparse_categorical_crossentropy
return K.sparse_categorical_crossentropy(y_pred, y_true)
File "/usr/local/lib/python3.4/dist-packages/keras/backend/tensorflow_backend.py", line 1993, in sparse_categorical_crossentropy
return tf.reshape(res, [-1, int(output_shape[-2])])
TypeError: int returned non-int (type NoneType)

Do you have any ideas to fix it?

@DingKe
Copy link
Owner

DingKe commented Jan 12, 2017

update keras to head should fix it, see this pr.

@kfmn
Copy link
Author

kfmn commented Jan 12, 2017

Thank you for your answer.
I used "sudo pip install --upgrade keras" to update but this had no effect on tensorflow_backend.py
Then I manually replaced this line as shown at this pr.
When I run python 2.7 it still raises error on the same line but with other synopsis:

 File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1994, in sparse_categorical_crossentropy
    return tf.reshape(res, tf.shape(output)[:-1])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 315, in _SliceHelper
    "Negative stop indices are not currently supported")

When I run python 3.4 this line is passed successfully and table with model topology is shown, but other exceptions are raised:

Epoch 1/100
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 409, in data_generator_task
    generator_output = next(generator)
  File "/home/superuser/nn_playground/gcnn/imdb_generator.py", line 72, in __call__
    data = cPickle.load(fp)
  File "/usr/lib/python3.4/codecs.py", line 319, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc9 in position 30: invalid continuation byte

Traceback (most recent call last):
  File "imdb_lm_gcnn.py", line 69, in <module>
    run_demo()
  File "imdb_lm_gcnn.py", line 65, in run_demo
    train_model()
  File "imdb_lm_gcnn.py", line 61, in train_model
    nb_epoch=nb_epoch, verbose=1)
  File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 1481, in fit_generator
    str(generator_output))
ValueError: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None

What do I do wrong ?

@kfmn
Copy link
Author

kfmn commented Jan 13, 2017

Probably, my pickle file imdp-full.pkl was not build correctly... Could you provide your file for me to compare and proceed?

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

2 participants