suriyadeepan / practical_seq2seq

A simple, minimal wrapper for tensorflow's seq2seq module, for experimenting with datasets rapidly
http://suriyadeepan.github.io/2016-12-31-practical-seq2seq/
GNU General Public License v3.0
569 stars 270 forks source link

error report #1

Closed nlp-study closed 7 years ago

nlp-study commented 7 years ago

Hi: this is a great work for me to learn seq2seq, but I find error when load your pre-training model.The log as follows:

Traceback (most recent call last): File "/home/zhang/project/seq2seq/practical_seq2seq_project/03-Twitter-chatbot.py", line 44, in sess = model.restore_last_session() File "/home/zhang/project/seq2seq/practical_seq2seq_project/seq2seq_wrapper.py", line 167, in restore_last_session saver.restore(sess, ckpt.model_checkpoint_path) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/saver.py", line 1388, in restore {self.saver_def.filename_tensor_name: save_path}) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 766, in run run_metadata_ptr) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 964, in _run feed_dict_string, options, run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1014, in _do_run target_list, options, run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1034, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [6002,1024] rhs shape= [8002,1024] [[Node: save/Assign_2 = Assign[T=DT_FLOAT, _class=["loc:@decoder/embedding_rnn_seq2seq/RNN/EmbeddingWrapper/embedding"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](decoder/embedding_rnn_seq2seq/RNN/EmbeddingWrapper/embedding, save/RestoreV2_2)]]

suriyadeepan commented 7 years ago

Assign requires shapes of both tensors to match. lhs shape= [6002,1024] rhs shape= [8002,1024]

Looks like vocabulary size mismatch to me. The dictionaries from metadata.pkl contains a vocabulary of 6002. I verified that. I'm not sure if the model was trained on a vocabulary size of 6002. I will check and update asap.

suriyadeepan commented 7 years ago

It seems the model is trained on 8002 vocabulary data. I have updated the link to download metadata that corresponds to a vocabulary of 8002. This commit fixes it.