nicolas-ivanov / debug_seq2seq

[unmaintained] Make seq2seq for keras work
233 stars 86 forks source link

Got an error when I run the train.py #1

Closed luojie-roger closed 8 years ago

luojie-roger commented 8 years ago

there is the error I got:

INFO:gensim.utils:detected Windows; aliasing chunkize to chunkize_serial
INFO:summa.preprocessing.cleaner:'pattern' package not found; tag filters are no                                                                                t available for English
INFO:lib.dialog_processor:Loading corpus data...
INFO:lib.dialog_processor:data/try_seq2seq\corpora_processed\movie_lines_cleaned_10k_m5.txt and data/try_seq2seq\words_index\w_idx_movie_lines_cleaned_10k_m5.txt exist, loading files from disk
INFO:__main__:-----
INFO:lib.w2v_model.w2v:Loading model from data/try_seq2seq\w2v_models\movie_lines_cleaned_10k_w5_m5_v128.bin
INFO:gensim.utils:loading Word2Vec object from data/try_seq2seq\w2v_models\movie_lines_cleaned_10k_w5_m5_v128.bin
INFO:gensim.utils:setting ignored attribute syn0norm to None
INFO:gensim.utils:setting ignored attribute cum_table to None
INFO:lib.w2v_model.w2v:Model "movie_lines_cleaned_10k_w5_m5_v128.bin" has been loaded.
INFO:__main__:-----
INFO:lib.nn_model.model:Initializing NN model with the following params:
INFO:lib.nn_model.model:Input dimension: 128 (token vector size)
INFO:lib.nn_model.model:Hidden dimension: 256
INFO:lib.nn_model.model:Output dimension: 1768 (token dict size)
INFO:lib.nn_model.model:Input seq length: 8
INFO:lib.nn_model.model:Output seq length: 8
INFO:lib.nn_model.model:Batch size: 64
INFO:lib.nn_model.model:Model is built
INFO:__main__:-----
INFO:lib.nn_model.train:Full-data-pass iteration num: 1
Epoch 1/1
Traceback (most recent call last):
  File "bin/train.py", line 37, in <module>
    learn()
  File "bin/train.py", line 33, in learn
    train_model(nn_model, w2v_model, dialog_lines_for_nn, index_to_token)
  File "E:\work\github\nicolas-ivanov\debug_seq2seq\lib\nn_model\train.py", line 84, in train_model
    nn_model.fit(X_train, Y_train, batch_size=TRAIN_BATCH_SIZE, nb_epoch=1, show_accuracy=True, verbose=1)
  File "build\bdist.win-amd64\egg\keras\models.py", line 489, in fit
  File "build\bdist.win-amd64\egg\keras\models.py", line 210, in _fit
  File "D:\soft\tool\Anaconda\lib\site-packages\theano-0.7.0-py2.7.egg\theano\compile\function_module.py", line 871, in __call__
    storage_map=getattr(self.fn, 'storage_map', None))
  File "D:\soft\tool\Anaconda\lib\site-packages\theano-0.7.0-py2.7.egg\theano\gof\link.py", line 314, in raise_with_op
    reraise(exc_type, exc_value, exc_trace)
  File "D:\soft\tool\Anaconda\lib\site-packages\theano-0.7.0-py2.7.egg\theano\compile\function_module.py", line 859, in __call__
    outputs = self.fn()
  File "D:\soft\tool\Anaconda\lib\site-packages\theano-0.7.0-py2.7.egg\theano\gof\op.py", line 876, in rval
    r = p(n, [x[0] for x in i], o)
  File "D:\soft\tool\Anaconda\lib\site-packages\theano-0.7.0-py2.7.egg\theano\tensor\subtensor.py", line 2160, in perform
    out[0] = inputs[0].__getitem__(inputs[1:])
IndexError: index 8 is out of bounds for axis 0 with size 8
Apply node that caused the error: AdvancedSubtensor(Subtensor{int64::}.0, Subtensor{int64}.0, Subtensor{int64}.0)
Toposort index: 486
Inputs types: [TensorType(float64, 3D), TensorType(int64, vector), TensorType(int64, vector)]
Inputs shapes: [(8L, 64L, 1768L), (512L,), (512L,)]
Inputs strides: [(905216L, 14144L, 8L), (8L,), (8L,)]
Inputs values: ['not shown', 'not shown', 'not shown']
Outputs clients: [[Shape_i{1}(AdvancedSubtensor.0), Elemwise{Sub}[(0, 1)](AdvancedSubtensor.0, AdvancedSubtensor.0)]]

Backtrace when the node is created:
  File "build\bdist.win-amd64\egg\keras\models.py", line 70, in weighted
    filtered_y_pred = y_pred[weights.nonzero()[:-1]]
nicolas-ivanov commented 8 years ago

@luojie-roger luojie-roger, do you use the latest version of seq2seq library? I had the same issue, but it's been fixed recently. Chech this up: https://github.com/farizrahman4u/seq2seq/issues/11

luojie-roger commented 8 years ago

@nicolas-ivanov It's work with the latest version of Seq2Seq library. I forgot update the Seq2Seq. Thanks very much!

nicolas-ivanov commented 8 years ago

@luojie-roger you are welcome!