Skip to content

Commit 8f17cfd

Browse files
committed
fix lr layer decay and shuffle
1 parent d58b705 commit 8f17cfd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

model_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def get_train_op(FLAGS, total_loss, grads_and_vars=None):
144144
gradients, variables = zip(*grads_and_vars)
145145
clipped, gnorm = tf.clip_by_global_norm(gradients, FLAGS.clip)
146146

147-
if FLAGS.lr_layer_decay_rate != 1.0:
147+
if getattr(FLAGS, "lr_layer_decay_rate", 1.0) != 1.0:
148148
n_layer = 0
149149
for i in range(len(clipped)):
150150
m = re.search(r"model/transformer/layer_(\d+?)/", variables[i].name)

run_classifier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ def file_based_convert_examples_to_features(
406406

407407
writer = tf.python_io.TFRecordWriter(output_file)
408408

409-
np.random.shuffle(examples)
410409
if num_passes > 1:
411410
examples *= num_passes
412411

@@ -704,6 +703,7 @@ def tokenize_fn(text):
704703
tf.logging.info("Use tfrecord file {}".format(train_file))
705704

706705
train_examples = processor.get_train_examples(FLAGS.data_dir)
706+
np.random.shuffle(train_examples)
707707
tf.logging.info("Num of train samples: {}".format(len(train_examples)))
708708

709709
file_based_convert_examples_to_features(

0 commit comments

Comments
 (0)