macanv / BERT-BiLSTM-CRF-NER

Tensorflow solution of NER task Using BiLSTM-CRF model with Google BERT Fine-tuning And private Server services
https://github.com/macanv/BERT-BiLSMT-CRF-NER
4.68k stars 1.25k forks source link

stop_if_no_decrease_hook #338

Open ghost opened 4 years ago

ghost commented 4 years ago

early_stopping_hook = tf.contrib.estimator.stop_if_no_decrease_hook( estimator=estimator, metric_name='loss', max_steps_without_decrease=num_train_steps, eval_dir=None, min_steps=0, run_every_secs=None, run_every_steps=args.save_checkpoints_steps) AttributeError: module 'tensorflow.contrib.estimator' has no attribute 'stop_if_no_decrease_hook' early_stopping_hook = tf.estimator.experimental.stop_if_no_decrease_hook( estimator=estimator, metric_name='loss', max_steps_without_decrease=num_train_steps, eval_dir=None, min_steps=0, run_every_secs=None, run_every_steps=args.save_checkpoints_steps) AttributeError: module 'tensorflow.estimator' has no attribute 'experimental' tf.version = '1.9.0'

macanv commented 4 years ago

please use tf version >= 1.13 or 1.14

senlindu commented 4 years ago

1.13 or 1.14 TensorFlow -- 1.15.0 Traceback (most recent call last): File "/usr/local/bin/bert-base-ner-train", line 8, in sys.exit(train_ner()) File "/usr/local/lib/python3.6/dist-packages/bert_base/runs/init.py", line 38, in train_ner train(args=args) File "/usr/local/lib/python3.6/dist-packages/bert_base/train/bert_lstm_ner.py", line 618, in train early_stopping_hook = tf.contrib.estimator.stop_if_no_decrease_hook( AttributeError: module 'tensorflow.contrib.estimator' has no attribute 'stop_if_no_decrease_hook'

zhaifly commented 3 years ago

1.13 or 1.14 TensorFlow -- 1.15.0 Traceback (most recent call last): File "/usr/local/bin/bert-base-ner-train", line 8, in sys.exit(train_ner()) File "/usr/local/lib/python3.6/dist-packages/bert_base/runs/init.py", line 38, in train_ner train(args=args) File "/usr/local/lib/python3.6/dist-packages/bert_base/train/bert_lstm_ner.py", line 618, in train early_stopping_hook = tf.contrib.estimator.stop_if_no_decrease_hook( AttributeError: module 'tensorflow.contrib.estimator' has no attribute 'stop_if_no_decrease_hook'

-        early_stopping_hook = tf.estimator.experimental.stop_if_no_decrease_hook(
+        early_stopping_hook = tf.contrib.estimator.stop_if_no_decrease_hook(