Skip to content

Commit d490aef

Browse files
committed
Fix undefined model and optimizer variables (#3067)
1 parent be7f1b3 commit d490aef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

recipes_source/distributed_checkpoint_recipe.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Now, let's create a toy module, wrap it with FSDP, feed it with some dummy input
8282
8383
def state_dict(self):
8484
# this line automatically manages FSDP FQN's, as well as sets the default state dict type to FSDP.SHARDED_STATE_DICT
85-
model_state_dict, optimizer_state_dict = get_state_dict(model, optimizer)
85+
model_state_dict, optimizer_state_dict = get_state_dict(self.model, self.optimizer)
8686
return {
8787
"model": model_state_dict,
8888
"optim": optimizer_state_dict
@@ -202,7 +202,7 @@ The reason that we need the ``state_dict`` prior to loading is:
202202
203203
def state_dict(self):
204204
# this line automatically manages FSDP FQN's, as well as sets the default state dict type to FSDP.SHARDED_STATE_DICT
205-
model_state_dict, optimizer_state_dict = get_state_dict(model, optimizer)
205+
model_state_dict, optimizer_state_dict = get_state_dict(self.model, self.optimizer)
206206
return {
207207
"model": model_state_dict,
208208
"optim": optimizer_state_dict

0 commit comments

Comments
 (0)