Moves shakespeare tutorial to high-performance stack.
"# pip package, you may need to edit the following to point to the '.whl' file\n",
"# on your local filesystem.\n",
"\n",
- "!pip install --quiet --upgrade tensorflow_federated\n",
- "!pip install --quiet --upgrade tf-nightly"
+ "!pip install --quiet tensorflow_federated\n",
+ "!pip install --quiet tf-nightly==1.15.0.dev20190805\n",
+ "\n",
+ "# NOTE: Jupyter requires a patch to asyncio.\n",
+ "!pip install --upgrade nest_asyncio\n",
+ "import nest_asyncio\n",
+ "nest_asyncio.apply()"
]
},
{
"import collections\n",
"import functools\n",
"import os\n",
+ "import six\n",
"import time\n",
"\n",
"import numpy as np\n",
"# We concatenate the test datasets for evaluation with Keras.\n",
"test_dataset = functools.reduce(\n",
" lambda d1, d2: d1.concatenate(d2),\n",
- " [data(client, test_data) for client in clients])"
+ " [data(client, test_data) for client in clients])\n",
+ "\n",
+ "# NOTE: If the statement below fails, it means that you are\n",
+ "# using an older version of TFF without the high-performance\n",
+ "# executor stack. Call `tff.framework.set_default_executor()`\n",
+ "# instead to use the default reference runtime.\n",
+ "if six.PY3:\n",
+ " tff.framework.set_default_executor(\n",
+ " tff.framework.create_local_executor(len(clients)))\n",
+ "\n"
]
},
{
