guillaumegenthial / tf_ner

Simple and Efficient Tensorflow implementations of NER models with tf.estimator and tf.data
Apache License 2.0
923 stars 275 forks source link

tensorflow.contrib.estimator #58

Closed gui-li closed 5 years ago

gui-li commented 5 years ago

Thank you for your code first. When I tried to run main.py in char_lstm_lstm_crf, I got the following problem: Traceback (most recent call last): File "C:/*(Never mind)/tf_ner/models/chars_lstm_lstm_crf/main.py", line 215, in hook = tf.contrib.estimator.stop_if_no_increase_hook( AttributeError: module 'tensorflow.contrib.estimator' has no attribute 'stop_if_no_increase_hook'

I did run successfully before, it's so weird.

HQH981118 commented 5 years ago

I have the same question, and have you solved it?

gui-li commented 5 years ago

Yes, replace that hook with the following tf.compat.v2.estimator.experimental.stop_if_no_increase_hook, it should solve this problem.

gui-li commented 5 years ago

https://www.tensorflow.org/api_docs/python/tf/estimator/experimental/stop_if_no_increase_hook Here is the link to the api

HQH981118 commented 5 years ago

ok, thx! I solved it and I find the version of tensorflow wasn't correct, so it may be wrong.

gui-li commented 5 years ago

@HQH981118 So, did you upgrade your tensrflow?

HQH981118 commented 5 years ago

Yes, I upgrade the version of tensorflow to 1.14 and use "tf.estimator.experimental.stop_if_noincrease" to replace "tf.contrib.estimator.stop_if_no_increase_hook". It works!