Skip to content

Commit

Permalink
Improve checkpoint loading instructions (#2826)
Browse files Browse the repository at this point in the history
  • Loading branch information
neogismm authored Jan 19, 2024
1 parent 7e089c1 commit a5eee50
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/source/how-to-save-and-load-model-checkpoints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.

0 comments on commit a5eee50

Please sign in to comment.