MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / load_buffer

Function load_buffer

deepspeed/module_inject/replace_module.py:811–818  ·  view source on GitHub ↗
(module, state_dict, prefix)

Source from the content-addressed store, hash-verified

809
810
811def load_buffer(module, state_dict, prefix):
812 for name in module._buffers.keys():
813 if module._buffers[name].data.is_meta:
814 module._buffers[name] = torch.nn.parameter.Parameter(
815 data=torch.empty_like(module._buffers[name].data, device="cpu"),
816 requires_grad=module._buffers[name].data.requires_grad)
817 if prefix + name in state_dict.keys():
818 module._buffers[name].data.copy_(state_dict[prefix + name])
819
820
821def _replace_module(model, policies, prefix='', layer_id=0, level_id=0, state_dict=None):

Callers 1

_replace_moduleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected