From a5eee500f300407f5a45783ba1f4402fb78889b9 Mon Sep 17 00:00:00 2001 From: Pritam Neog Date: Fri, 19 Jan 2024 18:39:17 +0530 Subject: [PATCH] Improve checkpoint loading instructions (#2826) --- doc/source/how-to-save-and-load-model-checkpoints.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/source/how-to-save-and-load-model-checkpoints.rst b/doc/source/how-to-save-and-load-model-checkpoints.rst index 404df485fbae..0d711e375cd8 100644 --- a/doc/source/how-to-save-and-load-model-checkpoints.rst +++ b/doc/source/how-to-save-and-load-model-checkpoints.rst @@ -91,3 +91,7 @@ To load your progress, you simply append the following lines to your code. Note print("Loading pre-trained model from: ", latest_round_file) state_dict = torch.load(latest_round_file) net.load_state_dict(state_dict) + state_dict_ndarrays = [v.cpu().numpy() for v in net.state_dict().values()] + parameters = fl.common.ndarrays_to_parameters(state_dict_ndarrays) + +Return/use this object of type ``Parameters`` wherever necessary, such as in the ``initial_parameters`` when defining a ``Strategy``. \ No newline at end of file