MCPcopy Create free account
hub / github.com/NationalGAILab/HoT / Load_model

Function Load_model

common/utils.py:191–201  ·  view source on GitHub ↗
(args, model)

Source from the content-addressed store, hash-verified

189
190
191def Load_model(args, model):
192 model_paths = sorted(glob.glob(os.path.join(args.previous_dir, '*.pth')))
193 model_path = model_paths[0]
194 print(model_path)
195
196 pre_dict = torch.load(model_path)
197 model_dict = model.state_dict()
198
199 state_dict = {k: v for k, v in pre_dict.items() if k in model_dict.keys()}
200 model_dict.update(state_dict)
201 model.load_state_dict(model_dict)
202

Callers 4

main_mixste.pyFile · 0.85
main_mixste_tpc.pyFile · 0.85
main_mhformer.pyFile · 0.85

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected