forked from vita-epfl/VoxDet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorganize_ckpt.py
More file actions
22 lines (15 loc) · 802 Bytes
/
Copy pathorganize_ckpt.py
File metadata and controls
22 lines (15 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import torch
from argparse import ArgumentParser
def parse_config():
parser = ArgumentParser()
parser.add_argument('--source_path', default='/mnt/vita/scratch/vita-students/users/wuli/code/CGFormer/pretrain/tensorboard/version_0/checkpoints/last2.ckpt')
parser.add_argument('--dst_path', default='/mnt/vita/scratch/vita-students/users/wuli/code/CGFormer/pretrain/tensorboard/version_0/checkpoints/last.ckpt')
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_config()
checkpoints = torch.load(args.source_path, map_location='cpu')['state_dict']
new_checkpoints = {}
for key in checkpoints:
new_checkpoints[key.replace('model.', '')] = checkpoints[key]
torch.save({'state_dict': new_checkpoints}, args.dst_path)