Commit a1b04a45 authored by Hongkun Yu's avatar Hongkun Yu Committed by A. Unique TensorFlower
Browse files

experimental_steps_per_execution -> steps_per_execution for TF 2.4 release.

PiperOrigin-RevId: 342566888
parent 2560387f
...@@ -229,7 +229,7 @@ def run_keras_compile_fit(model_dir, ...@@ -229,7 +229,7 @@ def run_keras_compile_fit(model_dir,
optimizer=optimizer, optimizer=optimizer,
loss=loss_fn, loss=loss_fn,
metrics=[fn() for fn in metric_fn], metrics=[fn() for fn in metric_fn],
experimental_steps_per_execution=steps_per_loop) steps_per_execution=steps_per_loop)
summary_dir = os.path.join(model_dir, 'summaries') summary_dir = os.path.join(model_dir, 'summaries')
summary_callback = tf.keras.callbacks.TensorBoard(summary_dir) summary_callback = tf.keras.callbacks.TensorBoard(summary_dir)
......
...@@ -144,7 +144,7 @@ def train(params, strategy, dataset=None): ...@@ -144,7 +144,7 @@ def train(params, strategy, dataset=None):
trainer.compile( trainer.compile(
optimizer=opt, optimizer=opt,
experimental_steps_per_execution=FLAGS.steps_per_loop) steps_per_execution=FLAGS.steps_per_loop)
summary_dir = os.path.join(FLAGS.model_dir, "summaries") summary_dir = os.path.join(FLAGS.model_dir, "summaries")
summary_callback = tf.keras.callbacks.TensorBoard( summary_callback = tf.keras.callbacks.TensorBoard(
summary_dir, update_freq=max(100, FLAGS.steps_per_loop)) summary_dir, update_freq=max(100, FLAGS.steps_per_loop))
......
...@@ -352,7 +352,7 @@ def train_and_eval( ...@@ -352,7 +352,7 @@ def train_and_eval(
optimizer=optimizer, optimizer=optimizer,
loss=loss_obj, loss=loss_obj,
metrics=metrics, metrics=metrics,
experimental_steps_per_execution=steps_per_loop) steps_per_execution=steps_per_loop)
initial_epoch = 0 initial_epoch = 0
if params.train.resume_checkpoint: if params.train.resume_checkpoint:
......
...@@ -75,7 +75,7 @@ class TrainConfig(hyperparams.Config): ...@@ -75,7 +75,7 @@ class TrainConfig(hyperparams.Config):
callbacks: An instance of CallbacksConfig. callbacks: An instance of CallbacksConfig.
metrics: An instance of MetricsConfig. metrics: An instance of MetricsConfig.
tensorboard: An instance of TensorboardConfig. tensorboard: An instance of TensorboardConfig.
set_epoch_loop: Whether or not to set `experimental_steps_per_execution` to set_epoch_loop: Whether or not to set `steps_per_execution` to
equal the number of training steps in `model.compile`. This reduces the equal the number of training steps in `model.compile`. This reduces the
number of callbacks run per epoch which significantly improves end-to-end number of callbacks run per epoch which significantly improves end-to-end
TPU training time. TPU training time.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment