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

Method module_state_dict

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

Source from the content-addressed store, hash-verified

4171 return tensor_list
4172
4173 def module_state_dict(self, destination=None, prefix="", keep_vars=False, exclude_frozen_parameters=False):
4174 sd = self.module.state_dict(destination=destination, prefix=prefix, keep_vars=keep_vars)
4175
4176 # Remove frozen parameter weights from state_dict if specified
4177 if exclude_frozen_parameters:
4178 for n, p in self.module.named_parameters():
4179 if not p.requires_grad and n in sd:
4180 del sd[n]
4181
4182 if self.random_ltd_enabled():
4183 sd = remove_random_ltd_state_dict(sd)
4184 return sd
4185
4186 @staticmethod
4187 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