MCPcopy Create free account
hub / github.com/Pixel-Talk/EHM-Tracker / remove_module

Function remove_module

src/modules/pixie/utils/util.py:424–430  ·  view source on GitHub ↗
(state_dict)

Source from the content-addressed store, hash-verified

422
423# original saved file with DataParallel
424def remove_module(state_dict):
425# create new OrderedDict that does not contain `module.`
426 new_state_dict = OrderedDict()
427 for k, v in state_dict.items():
428 name = k[7:] # remove `module.`
429 new_state_dict[name] = v
430 return new_state_dict
431
432def tensor2image(tensor):
433 image = tensor.detach().cpu().numpy()

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected