Skip to content

Commit f12e8b1

Browse files
committed
Handle the case that self.latest_step() is None in restore_state
1 parent 3857036 commit f12e8b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

guides/orbax_checkpoint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ def restore_state(self, step=None):
111111
step: The step number to restore the state from. Default=None
112112
restores the latest step.
113113
"""
114+
step = step or self.latest_step()
114115
if step is None:
115-
step = self.latest_step()
116+
return
116117
# Restore the model state only, not metrics.
117118
state, _ = self._get_state()
118119
restored_state = self.restore(step, args=ocp.args.StandardRestore(item=state))

0 commit comments

Comments
 (0)