MCPcopy Create free account
hub / github.com/RylonW/DocNLC / save_network

Method save_network

models/base_model.py:74–82  ·  view source on GitHub ↗
(self, network, network_label, iter_label)

Source from the content-addressed store, hash-verified

72 return str(network), sum(map(lambda x: x.numel(), network.parameters()))
73
74 def save_network(self, network, network_label, iter_label):
75 save_filename = '{}_{}.pth'.format(iter_label, network_label)
76 save_path = os.path.join(self.opt['path']['models'], save_filename)
77 if isinstance(network, nn.DataParallel) or isinstance(network, DistributedDataParallel):
78 network = network.module
79 state_dict = network.state_dict()
80 for key, param in state_dict.items():
81 state_dict[key] = param.cpu()
82 torch.save(state_dict, save_path)
83
84 def load_network(self, load_path, network, strict=True):
85 if isinstance(network, nn.DataParallel) or isinstance(network, DistributedDataParallel):

Callers 15

saveMethod · 0.80
save_bestMethod · 0.80
saveMethod · 0.80
save_bestMethod · 0.80
saveMethod · 0.80
save_bestMethod · 0.80
saveMethod · 0.80
save_bestMethod · 0.80
saveMethod · 0.80
save_bestMethod · 0.80
saveMethod · 0.80
save_bestMethod · 0.80

Calls 1

saveMethod · 0.45

Tested by

no test coverage detected