iamaaditya / neural-paraphrase-generation

Neural Paraphrase Generation
179 stars 57 forks source link

Error while prediction #17

Closed ghost closed 5 years ago

ghost commented 5 years ago

I tried to used the trained model for prediction. Here is the error when I call python predict.py --input_filename input.txt --output_filename output.txt --model_dir models:

Traceback (most recent call last):
  File "predict.py", line 59, in <module>
    tf.app.run()
  File "/home/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "predict.py", line 54, in main
    P = Predict()
  File "predict.py", line 45, in __init__
    self.predictor = tf.contrib.predictor.from_estimator(estimator, input_fn)
  File "/home/python2.7/dist-packages/tensorflow/contrib/predictor/predictor_factories.py", line 89, in from_estimator
    if isinstance(estimator, estimator.Estimator):
AttributeError: 'Estimator' object has no attribute 'Estimator'

Have you test your code at first? Do you have any idea how to solve it? Thanks a lot.

iamaaditya commented 5 years ago

Code works fine for me, see below.

[image: image.png]

Please check the version of your Tensorflow. Maybe you are using different version, which does not have the Estimator. My TF version is 1.12.

Thanks and Regards Adi

On Wed, Feb 27, 2019 at 9:58 PM rylanchiu notifications@github.com wrote:

I tried to used the trained model for prediction. Here is the error when I call python predict.py --input_filename input.txt --output_filename output.txt --model_dir models:

Traceback (most recent call last): File "predict.py", line 59, in tf.app.run() File "/home/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "predict.py", line 54, in main P = Predict() File "predict.py", line 45, in init self.predictor = tf.contrib.predictor.from_estimator(estimator, input_fn) File "/home/python2.7/dist-packages/tensorflow/contrib/predictor/predictor_factories.py", line 89, in from_estimator if isinstance(estimator, estimator.Estimator): AttributeError: 'Estimator' object has no attribute 'Estimator'

Have you test your code at first? Do you have any idea how to solve it? Thanks a lot.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/iamaaditya/neural-paraphrase-generation/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AB008mQpQbxB6fFhXJW9d2qHbLMWFNYrks5vR0W6gaJpZM4bV5r5 .

ghost commented 5 years ago

Thanks. The version info helps.