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

Method module_state_dict

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

Source from the content-addressed store, hash-verified

3816 return tensor_list
3817
3818 def module_state_dict(self, destination=None, prefix="", keep_vars=False, exclude_frozen_parameters=False):
3819 sd = self.module.state_dict(destination=destination, prefix=prefix, keep_vars=keep_vars)
3820
3821 # Remove frozen parameter weights from state_dict if specified
3822 if exclude_frozen_parameters:
3823 for n, p in self.module.named_parameters():
3824 if not p.requires_grad and n in sd:
3825 del sd[n]
3826
3827 if self.random_ltd_enabled():
3828 sd = remove_random_ltd_state_dict(sd)
3829 return sd
3830
3831 @staticmethod
3832 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