MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / module_state_dict

Method module_state_dict

deepspeed/runtime/pipe/engine.py:1299–1316  ·  view source on GitHub ↗

Override hack to save a pipe model and return the directory path of the save. This method should only be called by DeepSpeed's ``save_checkpoint()``. The recommended way of saving a ``PipelineModule`` outside of ``save_checkpoint()`` is ``save_state_dict()``. Return

(self, exclude_frozen_parameters=False)

Source from the content-addressed store, hash-verified

1297 raise PipelineError("Only train_batch() is accessible in pipeline mode.")
1298
1299 def module_state_dict(self, exclude_frozen_parameters=False):
1300 """Override hack to save a pipe model and return the directory path of the save.
1301
1302 This method should only be called by DeepSpeed's ``save_checkpoint()``. The
1303 recommended way of saving a ``PipelineModule`` outside of ``save_checkpoint()``
1304 is ``save_state_dict()``.
1305
1306 Returns:
1307 None
1308 """
1309 assert isinstance(self.module, PipelineModule)
1310 assert self._curr_ckpt_path is not None, \
1311 "PipelineEngine expects module_state_dict() to be called from save_checkpoint()"
1312
1313 self.module.save_state_dict(self._curr_ckpt_path,
1314 checkpoint_engine=self.checkpoint_engine,
1315 exclude_frozen_params=exclude_frozen_parameters)
1316 return None
1317
1318 def load_module_state_dict(self,
1319 checkpoint,

Callers

nothing calls this directly

Calls 1

save_state_dictMethod · 0.45

Tested by

no test coverage detected