Python bert.optimization.create_optimizer() Examples
The following are 1
code examples of bert.optimization.create_optimizer().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bert.optimization
, or try the search function
.
Example #1
Source File: tune_utils.py From embedding with MIT License | 5 votes |
def tune(self): global_step = tf.train.get_or_create_global_step() tf.logging.info("num_train_steps: " + str(self.num_train_steps)) tf.logging.info("num_warmup_steps: " + str(self.num_warmup_steps)) train_op = create_optimizer(self.loss, self.learning_rate, self.num_train_steps, self.num_warmup_steps, use_tpu=False) output_feed = [train_op, global_step, self.logits, self.loss] restore_vars = [v for v in tf.trainable_variables() if "bert" in v.name] sess = tf.Session() sess.run(tf.global_variables_initializer()) tf.train.Saver(restore_vars).restore(sess, self.pretrain_model_fname) saver = tf.train.Saver(max_to_keep=1) self.train(sess, saver, global_step, output_feed)