{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "id": "MhoQ0WE77laV" }, "outputs": [], "source": [ "##### Copyright 2019 The TensorFlow Authors." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "id": "_ckMIh7O7s6D" }, "outputs": [], "source": [ "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n", "# you may not use this file except in compliance with the License.\n", "# You may obtain a copy of the License at\n", "#\n", "# https://www.apache.org/licenses/LICENSE-2.0\n", "#\n", "# Unless required by applicable law or agreed to in writing, software\n", "# distributed under the License is distributed on an \"AS IS\" BASIS,\n", "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", "# See the License for the specific language governing permissions and\n", "# limitations under the License." ] }, { "cell_type": "markdown", "metadata": { "id": "jYysdyb-CaWM" }, "source": [ "# 使用 tf.distribute.Strategy 进行自定义训练" ] }, { "cell_type": "markdown", "metadata": { "id": "S5Uhzt6vVIB2" }, "source": [ "
![]() | \n",
" ![]() | \n",
" ![]() | \n",
" ![]() | \n",
"
MirroredStrategy
和 `TPUStrategy` 训练的 BERT 示例。此示例对于理解如何在分布式训练等过程中从检查点加载并生成定期检查点特别有帮助。\n",
"4. 使用 `MirroredStrategy`(可用 `keras_use_ctl` 标记启用)训练的 [NCF](https://github.com/tensorflow/models/blob/master/official/recommendation/ncf_keras_main.py) 示例。\n",
"5. [NMT](https://github.com/tensorflow/examples/blob/master/tensorflow_examples/models/nmt_with_attention/distributed_train.py) 使用 `MirroredStrategy`来训练的例子。\n",
"\n",
"可以在[分布策略指南](../../guide/distributed_training.ipynb)的*示例和教程*下找到更多示例。"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "6hEJNsokjOKs"
},
"source": [
"## 后续步骤\n",
"\n",
"- 在您的模型上尝试新的 `tf.distribute.Strategy` API。\n",
"- 访问[使用 `tf.function` 和 TensorFlow Profiler 提升性能](../../guide/function.ipynb)指南,详细了解优化 TensorFlow 模型性能的工具。\n",
"- 查看 [TensorFlow 中的分布式训练](../../guide/distributed_training.ipynb)指南,其中提供了可用分布策略的概述。"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "custom_training.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "xxx",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.12.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}