(args, model)
| 189 | |
| 190 | |
| 191 | def 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 |
no test coverage detected