Skip to content

Commit 2d10d58

Browse files
author
The kauldron Authors
committed
Allow "opt_state" to be loaded successfully.
PiperOrigin-RevId: 727383822
1 parent 205b34e commit 2d10d58

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kauldron/checkpoints/partial_loader.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,13 @@ def __kd_ocp_restore_post__(self, partial_restore: Any):
189189
state = ocp.utils.serialize_tree(self.state, keep_empty_nodes=True)
190190

191191
for new_path, _ in self.new_to_old.items():
192-
kontext.set_by_path(state, new_path, partial_restore[new_path])
192+
if new_path == 'opt_state':
193+
opt_state_as_dict = ocp.utils.serialize_tree(
194+
partial_restore[new_path], keep_empty_nodes=True
195+
)
196+
kontext.set_by_path(state, new_path, opt_state_as_dict)
197+
else:
198+
kontext.set_by_path(state, new_path, partial_restore[new_path])
193199

194200
state = ocp.utils.deserialize_tree(
195201
state, target=self.state, keep_empty_nodes=True

0 commit comments

Comments
 (0)