BERT-BiLSTM-CRF-NER icon indicating copy to clipboard operation
BERT-BiLSTM-CRF-NER copied to clipboard

如果想保存每次训练表现最好的那一个step的模型,该如何操作?

Open wby1999 opened this issue 5 years ago • 3 comments

wby1999 avatar Feb 13 '20 12:02 wby1999

简单说三种: 1.写hook,放到estimator中 2.使用bert4keras 写hook 3. 使用sess.run这种低阶api,以前怎么保存,现在还是一样。

如果你认为loss不再下降的时候,就是最好的模型,可以直接参考代码中的early stop 的使用(具体使用,参考官方文档。)。

macanv avatar Feb 18 '20 06:02 macanv

tf1.14中改为:tf.estimator.experimental.stop_if_no_decrease_hook 其他参数不变,然后无论怎么调整max_steps_without_decrease根本不会提前停止啊,好像没起作用。

currenttime avatar Apr 09 '20 06:04 currenttime

tf1.14中改为:tf.estimator.experimental.stop_if_no_decrease_hook 其他参数不变,然后无论怎么调整max_steps_without_decrease根本不会提前停止啊,好像没起作用。

我这里会,我设的1000,原本要训练9900step,现在5001step就停下来了

Heaven-zhw avatar May 01 '20 16:05 Heaven-zhw