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

Method module_state_dict

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

Source from the content-addressed store, hash-verified

4089 return tensor_list
4090
4091 def module_state_dict(self, destination=None, prefix="", keep_vars=False, exclude_frozen_parameters=False):
4092 sd = self.module.state_dict(destination=destination, prefix=prefix, keep_vars=keep_vars)
4093
4094 # Remove frozen parameter weights from state_dict if specified
4095 if exclude_frozen_parameters:
4096 for n, p in self.module.named_parameters():
4097 if not p.requires_grad and n in sd:
4098 del sd[n]
4099
4100 if self.random_ltd_enabled():
4101 sd = remove_random_ltd_state_dict(sd)
4102 return sd
4103
4104 @staticmethod
4105 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