sogou / SogouMRCToolkit

This toolkit was designed for the fast and efficient development of modern machine comprehension models, including both published models and original prototypes.
Apache License 2.0
746 stars 162 forks source link

global_step always equals to zero #24

Open MYWmiss opened 5 years ago

MYWmiss commented 5 years ago

tensorboard the point of loss float up and down the Y axis

yylun commented 5 years ago

@MYWmiss yes, we miss the global_step parameter in defining train_op.

To make global_step increase, take BiDAF as example, change https://github.com/sogou/SMRCToolkit/blob/master/sogou_mrc/model/bidaf.py#L214-L216 to

def compile(self, optimizer, initial_lr):
    self.optimizer = optimizer(initial_lr)
    global_step = tf.train.get_or_create_global_step()
    self.train_op = self.optimizer.minimize(self.loss, global_step=gloal_step)

Thx for pointing it out, will fix soon 😃