daniel-kukiela / nmt-chatbot

NMT Chatbot
GNU General Public License v3.0
385 stars 213 forks source link

error after I changed # Vocab max size 'vocab_size': from 15000 to 'vocab_size': 55000, #110

Open hotelroyal opened 5 years ago

hotelroyal commented 5 years ago

Hello, sorry to bother...

I added my own set of dataset (different dates in New_data) and affected the 'vocab_size': from 15000 to 'vocab_size': 55000 and I got this running locally on my laptop.

any cue?

although all seemed to be working just fine on paperspace.

Thanks you soooo much for this great demo.

Exception in thread Thread-5: Traceback (most recent call last): File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call return fn(*args) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,9] = 25459 is not in [0, 15003) [[{{node dynamic_seq2seq/decoder/embedding_lookup}} = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@dynamic_seq2seq/encoder/embedding_lookup"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](embeddings/embedding_share/read, dynamic_seq2seq/decoder/transpose_1, dynamic_seq2seq/decoder/embedding_lookup/axis)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/marc/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/home/marc/anaconda3/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "train.py", line 88, in nmt_train tf.app.run(main=nmt.main, argv=[os.getcwd() + '\nmt\nmt\nmt.py'] + unparsed) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "/home/marc/Desktop/nmt-chatbot/nmt/nmt.py", line 599, in main run_main(FLAGS, default_hparams, train_fn, inference_fn) File "/home/marc/Desktop/nmt-chatbot/nmt/nmt.py", line 592, in run_main train_fn(hparams, target_session=target_session, summary_callback=summary_callback) File "/home/marc/Desktop/nmt-chatbot/nmt/train.py", line 345, in train sample_tgt_data, avg_ckpts, summary_callback=summary_callback) File "/home/marc/Desktop/nmt-chatbot/nmt/train.py", line 172, in run_full_eval eval_model, eval_sess, model_dir, hparams, summary_writer) File "/home/marc/Desktop/nmt-chatbot/nmt/train.py", line 72, in run_internal_eval summary_writer, "dev") File "/home/marc/Desktop/nmt-chatbot/nmt/train.py", line 503, in _internal_eval ppl = model_helper.compute_perplexity(model, sess, label) File "/home/marc/Desktop/nmt-chatbot/nmt/model_helper.py", line 597, in compute_perplexity loss, predict_count, batch_size = model.eval(sess) File "/home/marc/Desktop/nmt-chatbot/nmt/model.py", line 272, in eval self.batch_size]) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run feed_dict_tensor, options, run_metadata) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run run_metadata) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[1,9] = 25459 is not in [0, 15003) [[node dynamic_seq2seq/decoder/embedding_lookup (defined at /home/marc/Desktop/nmt-chatbot/nmt/model.py:393) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@dynamic_seq2seq/encoder/embedding_lookup"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](embeddings/embedding_share/read, dynamic_seq2seq/decoder/transpose_1, dynamic_seq2seq/decoder/embedding_lookup/axis)]]

Caused by op 'dynamic_seq2seq/decoder/embedding_lookup', defined at: File "/home/marc/anaconda3/lib/python3.6/threading.py", line 884, in _bootstrap self._bootstrap_inner() File "/home/marc/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/home/marc/anaconda3/lib/python3.6/threading.py", line 864, in run self._target(*self._args, *self._kwargs) File "train.py", line 88, in nmt_train tf.app.run(main=nmt.main, argv=[os.getcwd() + '\nmt\nmt\nmt.py'] + unparsed) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "/home/marc/Desktop/nmt-chatbot/nmt/nmt.py", line 599, in main run_main(FLAGS, default_hparams, train_fn, inference_fn) File "/home/marc/Desktop/nmt-chatbot/nmt/nmt.py", line 592, in run_main train_fn(hparams, target_session=target_session, summary_callback=summary_callback) File "/home/marc/Desktop/nmt-chatbot/nmt/train.py", line 303, in train eval_model = model_helper.create_eval_model(model_creator, hparams, scope) File "/home/marc/Desktop/nmt-chatbot/nmt/model_helper.py", line 162, in create_eval_model extra_args=extra_args) File "/home/marc/Desktop/nmt-chatbot/nmt/attention_model.py", line 61, in init extra_args=extra_args) File "/home/marc/Desktop/nmt-chatbot/nmt/model.py", line 109, in init res = self.build_graph(hparams, scope=scope) File "/home/marc/Desktop/nmt-chatbot/nmt/model.py", line 303, in build_graph encoder_outputs, encoder_state, hparams) File "/home/marc/Desktop/nmt-chatbot/nmt/model.py", line 393, in _build_decoder self.embedding_decoder, target_input) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/ops/embedding_ops.py", line 313, in embedding_lookup transform_fn=None) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/ops/embedding_ops.py", line 133, in _embedding_lookup_and_transform result = _clip(array_ops.gather(params[0], ids, name=name), File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 2675, in gather return gen_array_ops.gather_v2(params, indices, axis, name=name) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3332, in gather_v2 "GatherV2", params=params, indices=indices, axis=axis, name=name) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(args, **kwargs) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op op_def=op_def) File "/home/marc/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1770, in init self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): indices[1,9] = 25459 is not in [0, 15003) [[node dynamic_seq2seq/decoder/embedding_lookup (defined at /home/marc/Desktop/nmt-chatbot/nmt/model.py:393) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@dynamic_seq2seq/encoder/embedding_lookup"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](embeddings/embedding_share/read, dynamic_seq2seq/decoder/transpose_1, dynamic_seq2seq/decoder/embedding_lookup/axis)]]

dwebb33 commented 5 years ago

I got a similar error

ppowdderr commented 4 years ago

Maybe it's because that your CPU/GPU can't handle 55000 vocab size. ^^^^

kaljitism commented 4 years ago

You have increased the vocab size but here the thing to note is vocab is being constructed on the words(tokens) in the training data. Your training data does not contains that much number of tokens so you are getting the error.