tensorlayer / seq2seq-chatbot

Chatbot in 200 lines of code using TensorLayer
https://github.com/tensorlayer/tensorlayer
837 stars 315 forks source link

Inference mode and TF compatibility (#16) #18

Closed luomai closed 5 years ago

luomai commented 5 years ago

@pskrunner14

We have rolled back the PR you recently submitted as the PR contains the error. Could you please have a look on it and we can merge it again?

luomai commented 5 years ago

@zsdonghao could you leave the error message here?

zsdonghao commented 5 years ago
Epoch[1/50]:  63%|█████████████████████████████████████████████████████████████████████████████████████████████▉                                                        | 1786/2852 [02:45<01:38, 10.77it/s]Epoch [1/50]: loss 5.7929
Query > happy birthday have a nice day
Traceback (most recent call last):
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
    return fn(*args)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1312, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1420, in _call_tf_sessionrun
    status, run_metadata)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'decode_seqs_1' with dtype int64 and shape [1,?]
         [[Node: decode_seqs_1 = Placeholder[dtype=DT_INT64, shape=[1,?], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
         [[Node: model_1/seq2seq/decode/rnn/while/Exit_6/_93 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_472_model_1/seq2seq/decode/rnn/while/Exit_6", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 252, in <module>
    main()
  File "main.py", line 247, in main
    train()
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "main.py", line 187, in train
    sentence = inference(seed)
  File "main.py", line 122, in inference
    {encode_seqs2: [seed_id]})
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 905, in run
    run_metadata_ptr)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1140, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
    run_metadata)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'decode_seqs_1' with dtype int64 and shape [1,?]
         [[Node: decode_seqs_1 = Placeholder[dtype=DT_INT64, shape=[1,?], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
         [[Node: model_1/seq2seq/decode/rnn/while/Exit_6/_93 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_472_model_1/seq2seq/decode/rnn/while/Exit_6", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

Caused by op 'decode_seqs_1', defined at:
  File "main.py", line 252, in <module>
    main()
  File "main.py", line 247, in main
    train()
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "main.py", line 97, in train
    decode_seqs2 = tf.placeholder(dtype=tf.int64, shape=[1, None], name="decode_seqs")
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py", line 1777, in placeholder
    return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 4521, in placeholder
    "Placeholder", dtype=dtype, shape=shape, name=name)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3290, in create_op
    op_def=op_def)
  File "/home/hao/Workspace/env3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1654, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'decode_seqs_1' with dtype int64 and shape [1,?]
         [[Node: decode_seqs_1 = Placeholder[dtype=DT_INT64, shape=[1,?], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
         [[Node: model_1/seq2seq/decode/rnn/while/Exit_6/_93 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_472_model_1/seq2seq/decode/rnn/while/Exit_6", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]