Skip to content

Commit

Permalink
Docs improvment (#2900)
Browse files Browse the repository at this point in the history
* Improve doc

* Improve doc
  • Loading branch information
mohammadnaseri authored Feb 4, 2024
1 parent f3d2004 commit f4e1c2d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions doc/source/tutorial-series-get-started-with-flower-pytorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"It is possible to switch to a runtime that has GPU acceleration enabled (on Google Colab: `Runtime > Change runtime type > Hardware acclerator: GPU > Save`). Note, however, that Google Colab is not always able to offer GPU acceleration. If you see an error related to GPU availability in one of the following sections, consider switching back to CPU-based execution by setting `DEVICE = torch.device(\"cpu\")`. If the runtime has GPU acceleration enabled, you should see the output `Training on cuda`, otherwise it'll say `Training on cpu`."
"It is possible to switch to a runtime that has GPU acceleration enabled (on Google Colab: `Runtime > Change runtime type > Hardware accelerator: GPU > Save`). Note, however, that Google Colab is not always able to offer GPU acceleration. If you see an error related to GPU availability in one of the following sections, consider switching back to CPU-based execution by setting `DEVICE = torch.device(\"cpu\")`. If the runtime has GPU acceleration enabled, you should see the output `Training on cuda`, otherwise it'll say `Training on cpu`."
]
},
{
Expand Down Expand Up @@ -368,14 +368,14 @@
"metadata": {},
"outputs": [],
"source": [
"def get_parameters(net) -> List[np.ndarray]:\n",
" return [val.cpu().numpy() for _, val in net.state_dict().items()]\n",
"\n",
"\n",
"def set_parameters(net, parameters: List[np.ndarray]):\n",
" params_dict = zip(net.state_dict().keys(), parameters)\n",
" state_dict = OrderedDict({k: torch.Tensor(v) for k, v in params_dict})\n",
" net.load_state_dict(state_dict, strict=True)"
" net.load_state_dict(state_dict, strict=True)\n",
"\n",
"\n",
"def get_parameters(net) -> List[np.ndarray]:\n",
" return [val.cpu().numpy() for _, val in net.state_dict().items()]"
]
},
{
Expand Down Expand Up @@ -485,7 +485,7 @@
")\n",
"\n",
"# Specify the resources each of your clients need. By default, each\n",
"# client will be allocated 1x CPU and 0x CPUs\n",
"# client will be allocated 1x CPU and 0x GPUs\n",
"client_resources = {\"num_cpus\": 1, \"num_gpus\": 0.0}\n",
"if DEVICE.type == \"cuda\":\n",
" # here we are asigning an entire GPU for each client.\n",
Expand Down

0 comments on commit f4e1c2d

Please sign in to comment.