MCPcopy Create free account
hub / github.com/microsoft/LoRA / load

Method load

examples/NLU/src/transformers/modeling_utils.py:1114–1127  ·  view source on GitHub ↗
(module: nn.Module, prefix="")

Source from the content-addressed store, hash-verified

1112 # PyTorch's `_load_from_state_dict` does not copy parameters in a module's descendants
1113 # so we need to apply the function recursively.
1114 def load(module: nn.Module, prefix=""):
1115 local_metadata = {} if metadata is None else metadata.get(prefix[:-1], {})
1116 module._load_from_state_dict(
1117 state_dict,
1118 prefix,
1119 local_metadata,
1120 True,
1121 missing_keys,
1122 unexpected_keys,
1123 error_msgs,
1124 )
1125 for name, child in module._modules.items():
1126 if child is not None:
1127 load(child, prefix + name + ".")
1128
1129 # Make sure we are able to load base models as well as derived models (with heads)
1130 start_prefix = ""

Callers 15

gpt2_beam.pyFile · 0.80
get_encoderFunction · 0.80
gpt2_ft.pyFile · 0.80
split_lora.pyFile · 0.80
convert.pyFile · 0.80
onnx_compliancyFunction · 0.80
quantizeFunction · 0.80
from_pretrainedMethod · 0.80
init_deepspeedFunction · 0.80
save_metricsFunction · 0.80

Calls 1

itemsMethod · 0.45