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

has no attribute 'stop_if_no_increase_hook' for tensorflow 1.9 #62

Open kbwzy opened 5 years ago

kbwzy commented 5 years ago

Traceback (most recent call last): File "main.py", line 171, in hook = tf.contrib.estimator.stop_if_no_increase_hook( AttributeError: module 'tensorflow.contrib.estimator' has no attribute 'stop_if_no_increase_hook'

ivsanro1 commented 5 years ago

You have to change the call tf.contrib.estimator.stop_if_no_increase_hook to tf.estimator.experimental.stop_if_no_increase_hook.

For example, in /models/lstm_crf/main.py, im the line 171, change:

hook = tf.contrib.estimator.stop_if_no_increase_hook(
            estimator, 'f1', 500, min_steps=8000, run_every_secs=120)

to:

hook = tf.estimator.experimental.stop_if_no_increase_hook(
            estimator, 'f1', 500, min_steps=8000, run_every_secs=120)

This worked for me for tensorflow==1.15.0