MCPcopy Create free account
hub / github.com/TaoRuijie/TalkNet-ASD / loadParameters

Method loadParameters

talkNet.py:81–94  ·  view source on GitHub ↗
(self, path)

Source from the content-addressed store, hash-verified

79 torch.save(self.state_dict(), path)
80
81 def loadParameters(self, path):
82 selfState = self.state_dict()
83 loadedState = torch.load(path)
84 for name, param in loadedState.items():
85 origName = name;
86 if name not in selfState:
87 name = name.replace("module.", "")
88 if name not in selfState:
89 print("%s is not in the model."%origName)
90 continue
91 if selfState[name].size() != loadedState[origName].size():
92 sys.stderr.write("Wrong parameter length: %s, model: %s, loaded: %s"%(origName, selfState[name].size(), loadedState[origName].size()))
93 continue
94 selfState[name].copy_(param)

Callers 2

evaluate_networkFunction · 0.80
mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected