dennybritz / chatbot-retrieval

Dual LSTM Encoder for Dialog Response Generation
MIT License
1.58k stars 672 forks source link

Upgraded to Python 3 still could not run udc_test.py? #16

Open tviangte opened 8 years ago

tviangte commented 8 years ago

I upgraded to Python 3 but errors still ... Any parameters need to change in udc_test.py in order to evaluate the model?

Traceback (most recent call last): File "udc_test.py", line 39, in estimator.evaluate(input_fn=input_fn_test, steps=None, metrics=eval_metrics) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 356, in evaluate name=name) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 641, in _evaluate_model max_steps=steps) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/graph_actions.py", line 773, in evaluate _write_summary_results(output_dir, eval_results, current_global_step) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/graph_actions.py", line 613, in _write_summary_results _eval_results_to_str(eval_results)) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/graph_actions.py", line 607, in _eval_results_to_str return ', '.join('%s = %s' % (k, v) for k, v in eval_results.items()) AttributeError: 'NoneType' object has no attribute 'items'

craymichael commented 8 years ago

I just had this strange issue as well. Occurred after calling evaluate on a just-trained Estimator passing in the following metrics dict:

{'auc': <function streaming_auc at 0x49226e0>, 'recall': <function streaming_recall at 0x49225f0>,  'precision': <function streaming_precision at 0x4922578>, 'confusion_matrix': <function confusion_matrix at 0x4730d70>, 'accuracy': <function streaming_accuracy at 0x4922500>}

Traceback is below:

Traceback (most recent call last):
  File "main.py", line 301, in <module>
    tf.app.run()
  File "/usr/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "main.py", line 220, in main
    eval_steps=1
  File "/opt/projects/tensorflow/cross_validation/evaluate.py", line 54, in evaluate
    metrics=metrics
  File "/usr/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 356, in evaluate
    name=name)
  File "/usr/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 641, in _evaluate_model
    max_steps=steps)
  File "/usr/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/graph_actions.py", line 773, in evaluate
    _write_summary_results(output_dir, eval_results, current_global_step)
  File "/usr/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/graph_actions.py", line 613, in _write_summary_results
    _eval_results_to_str(eval_results))
  File "/usr/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/graph_actions.py", line 607, in _eval_results_to_str
    return ', '.join('%s = %s' % (k, v) for k, v in eval_results.items())
AttributeError: 'NoneType' object has no attribute 'items'
craymichael commented 8 years ago

Never mind, this is a direct result from having a model that hasn't been trained, i.e. no weights or other variables saved. This can result from trying to use training files that don't exist when fit is called. If you need help debugging this, use tf.logging.set_verbosity(tf.logging.DEBUG) and look at the logs carefully to see what's going on. The Estimator will not fail due to user misconfiguration

jugador commented 7 years ago

While training the model I am getting the error InvalidArgumentError (see above for traceback): Incompatible shapes: [80,1] vs. [160,1] [[Node: prediction/logistic_loss/mul = Mul[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](prediction/Squeeze, prediction/ToFloat)]] I am running it with python3, any idea what might be causing the issue?

davideboschetto commented 7 years ago

same error for me.

tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [80,1] vs. [160,1] [[Node: prediction/logistic_loss/mul = Mul[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](prediction/Squeeze, prediction/ToFloat)]]

ghost commented 7 years ago

Some error for me. InvalidArgumentError (see above for traceback): Incompatible shapes: [80,1] vs. [160,1] [[Node: prediction/logistic_loss/mul = Mul[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](prediction/Squeeze, prediction/ToFloat)]]