MCPcopy Create free account
hub / github.com/SooLab/CGFormer / load

Function load

model/mmcv_custom/checkpoint.py:67–79  ·  view source on GitHub ↗
(module, prefix='')

Source from the content-addressed store, hash-verified

65
66 # use _load_from_state_dict to enable checkpoint version control
67 def load(module, prefix=''):
68 # recursively check parallel module in case that the model has a
69 # complicated structure, e.g., nn.Module(nn.Module(DDP))
70 if is_module_wrapper(module):
71 module = module.module
72 local_metadata = {} if metadata is None else metadata.get(
73 prefix[:-1], {})
74 module._load_from_state_dict(state_dict, prefix, local_metadata, True,
75 all_missing_keys, unexpected_keys,
76 err_msg)
77 for name, child in module._modules.items():
78 if child is not None:
79 load(child, prefix + name + '.')
80
81 load(module)
82 load = None # break load->load reference cycle

Callers 4

forwardMethod · 0.85
load_state_dictFunction · 0.85
loadMethod · 0.85
from_pretrainedMethod · 0.85

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected