MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / remove_prefix_from_state_dict

Function remove_prefix_from_state_dict

PATH/core/utils.py:132–136  ·  view source on GitHub ↗
(state_dict, prefix)

Source from the content-addressed store, hash-verified

130
131
132def remove_prefix_from_state_dict(state_dict, prefix):
133 for old_key in list(state_dict.keys()):
134 if old_key.startswith(prefix):
135 new_key = remove_prefix_string(old_key, prefix)
136 state_dict[new_key] = state_dict.pop(old_key)
137
138
139def load_state(path, model, ignore=[], optimizer=None, cuda=False, recover=False,

Callers 1

load_stateFunction · 0.85

Calls 1

remove_prefix_stringFunction · 0.85

Tested by

no test coverage detected