Skip to content

Commit

Permalink
experiment with distributed strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcavazos committed Sep 28, 2021
1 parent 1721db4 commit eb89841
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions people-and-planet-ai/timeseries-classification/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ def run(
# For this sample we are using a mirrored distribution strategy,
# which consists of a single machine with multiple GPUs.
# https://blog.tensorflow.org/2020/12/getting-started-with-distributed-tensorflow-on-gcp.html
distributed_strategy = tf.distribute.MirroredStrategy()
# distributed_strategy = tf.distribute.MirroredStrategy()
distributed_strategy = tf.distribute.get_strategy()

# Create the training and evaluation datasets from the TFRecord files.
logging.info("Creating datasets")
Expand All @@ -215,10 +216,12 @@ def run(
# Train the model.
logging.info("Training the model")
model.fit(
train_dataset.repeat(),
steps_per_epoch=train_steps,
validation_data=eval_dataset.repeat(),
validation_steps=eval_steps,
# train_dataset.repeat(),
# steps_per_epoch=train_steps,
# validation_data=eval_dataset.repeat(),
# validation_steps=eval_steps,
train_dataset,
validation_data=eval_dataset,
callbacks=[
keras.callbacks.TensorBoard(tensorboard_dir, update_freq="batch"),
keras.callbacks.ModelCheckpoint(
Expand Down

0 comments on commit eb89841

Please sign in to comment.