MCPcopy
hub / github.com/CLUEbenchmark/CLUE / load

Function load

baselines/models_pytorch/mrc_pytorch/tools/utils.py:111–118  ·  view source on GitHub ↗
(module, prefix='')

Source from the content-addressed store, hash-verified

109 state_dict._metadata = metadata
110
111 def load(module, prefix=''):
112 local_metadata = {} if metadata is None else metadata.get(prefix[:-1], {})
113
114 module._load_from_state_dict(
115 state_dict, prefix, local_metadata, True, missing_keys, unexpected_keys, error_msgs)
116 for name, child in module._modules.items():
117 if child is not None:
118 load(child, prefix + name + '.')
119
120 load(model, prefix='' if hasattr(model, 'bert') else 'bert.')
121

Callers 5

torch_init_modelFunction · 0.70
loadMethod · 0.50
from_pretrainedMethod · 0.50
loadMethod · 0.50
from_pretrainedMethod · 0.50

Calls 1

getMethod · 0.80

Tested by

no test coverage detected