Path: blob/master/site/zh-cn/federated/tutorials/simulations.ipynb
25118 views
Kernel: Python 3
Copyright 2019 The TensorFlow Authors.
In [ ]:
High-performance simulations with TFF
本教程将介绍如何在各种常见场景中使用 TFF 设置高性能模拟。
TODO(b/134543154):填充内容,此处涉及以下几点:
using GPUs in a single-machine setup,
multi-machine setup on GCP/GKE, with and without TPUs,
interfacing MapReduce-like backends,
current limitations and when/how they will be relaxed.
准备工作
首先,请确保您的笔记本电脑连接到具有已编译相关组件(包括用于多机场景的 gRPC 依赖关系)的后端。
现在,我们从加载 TFF 网站上的 MNIST 示例开始,然后声明 Python 函数,该函数将在一组 10 个客户端上运行一个小型实验循环。
In [ ]:
/bin/sh: pip: command not found
In [ ]:
单机模拟
现在默认打开。
In [ ]:
train metrics OrderedDict([('sparse_categorical_accuracy', 0.15329218), ('loss', 2.918891), ('num_examples', 9720), ('num_batches', 490)]), round time 4.64 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.18004115), ('loss', 2.7677088), ('num_examples', 9720), ('num_batches', 490)]), round time 2.37 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.21841563), ('loss', 2.511075), ('num_examples', 9720), ('num_batches', 490)]), round time 2.30 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.27160493), ('loss', 2.340346), ('num_examples', 9720), ('num_batches', 490)]), round time 2.25 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.34115225), ('loss', 2.0537064), ('num_examples', 9720), ('num_batches', 490)]), round time 2.27 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.3745885), ('loss', 1.9158486), ('num_examples', 9720), ('num_batches', 490)]), round time 2.21 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.41502059), ('loss', 1.7523248), ('num_examples', 9720), ('num_batches', 490)]), round time 2.19 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.47644034), ('loss', 1.6085855), ('num_examples', 9720), ('num_batches', 490)]), round time 2.20 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.5126543), ('loss', 1.5272282), ('num_examples', 9720), ('num_batches', 490)]), round time 2.27 seconds
train metrics OrderedDict([('sparse_categorical_accuracy', 0.5576132), ('loss', 1.393721), ('num_examples', 9720), ('num_batches', 490)]), round time 2.16 seconds
在 GCP/GKE、GPU、TPU 等上进行多机模拟…
敬请期待。