Skip to content

Commit

Permalink
Add examples as it was requested in an email.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 254202446
  • Loading branch information
yashk2810 authored and copybara-github committed Jun 20, 2019
1 parent f66e152 commit 377be33
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
15 changes: 15 additions & 0 deletions site/en/r2/tutorials/distribute/keras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,21 @@
" print ('Eval loss: {}, Eval Accuracy: {}'.format(eval_loss, eval_acc))"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "MUZwaz4AKjtD"
},
"source": [
"### Examples and Tutorials\n",
"Here are some examples for using distribution strategy with keras fit/compile:\n",
"1. [Transformer](https://github.com/tensorflow/models/blob/master/official/transformer/v2/transformer_main.py) example trained using `tf.distribute.MirroredStrategy`\n",
"2. [NCF](https://github.com/tensorflow/models/blob/master/official/recommendation/ncf_keras_main.py) example trained using `tf.distribute.MirroredStrategy`.\n",
"\n",
"More examples listed in the [Distribution Strategy Guide](https://www.tensorflow.org/guide/distribute_strategy#examples_and_tutorials)"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down
20 changes: 20 additions & 0 deletions site/en/r2/tutorials/distribute/training_loops.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,26 @@
"If you use `tf.metrics.Mean` to track loss across the two replicas, the result is different. In this example, you end up with a `total` of 3.50 and `count` of 2, which results in `total`/`count` = 1.75 when `result()` is called on the metric. Loss calculated with `tf.keras.Metrics` is scaled by an additional factor that is equal to the number of replicas in sync."
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "xisYJaV9KZTN"
},
"source": [
"### Examples and Tutorials\n",
"Here are some examples for using distribution strategy with custom training loops:\n",
"\n",
"1. [Tutorial](../tutorials/distribute/training_loops.ipynb) to train MNIST using `MirroredStrategy`.\n",
"2. [DenseNet](https://github.com/tensorflow/examples/blob/master/tensorflow_examples/models/densenet/distributed_train.py) example using `MirroredStrategy`.\n",
"1. [BERT](https://github.com/tensorflow/models/blob/master/official/bert/run_classifier.py) example trained using `MirroredStrategy` and `TPUStrategy`.\n",
"This example is particularly helpful for understanding how to load from a checkpoint and generate periodic checkpoints during distributed training etc.\n",
"2. [NCF](https://github.com/tensorflow/models/blob/master/official/recommendation/ncf_keras_main.py) example trained using `MirroredStrategy` that can be enabled using the `keras_use_ctl` flag.\n",
"3. [NMT](https://github.com/tensorflow/examples/blob/master/tensorflow_examples/models/nmt_with_attention/distributed_train.py) example trained using `MirroredStrategy`.\n",
"\n",
"More examples listed in the [Distribution Strategy Guide](https://www.tensorflow.org/guide/distribute_strategy#examples_and_tutorials)"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down

0 comments on commit 377be33

Please sign in to comment.