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

Method module_state_dict

deepspeed/runtime/engine.py:3828–3839  ·  view source on GitHub ↗
(self, destination=None, prefix="", keep_vars=False, exclude_frozen_parameters=False)

Source from the content-addressed store, hash-verified

3826 return tensor_list
3827
3828 def module_state_dict(self, destination=None, prefix="", keep_vars=False, exclude_frozen_parameters=False):
3829 sd = self.module.state_dict(destination=destination, prefix=prefix, keep_vars=keep_vars)
3830
3831 # Remove frozen parameter weights from state_dict if specified
3832 if exclude_frozen_parameters:
3833 for n, p in self.module.named_parameters():
3834 if not p.requires_grad and n in sd:
3835 del sd[n]
3836
3837 if self.random_ltd_enabled():
3838 sd = remove_random_ltd_state_dict(sd)
3839 return sd
3840
3841 @staticmethod
3842 def _make_autoep_folding_metadata(folding_spec,

Callers 3

_save_checkpointMethod · 0.95
save_16bit_modelMethod · 0.95
_save_moe_checkpointMethod · 0.45

Calls 3

random_ltd_enabledMethod · 0.95
state_dictMethod · 0.45

Tested by

no test coverage detected