File size: 1,953 Bytes
26fd00c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import torch
def change_name(ckpt_path, name):
print(ckpt_path, name)
state = torch.load(ckpt_path, map_location=torch.device('cpu'))
state['cfg']['model']._name = name
state['cfg']['model']._arch = name
torch.save(state, ckpt_path)
name="unival_base"
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_caption_stage_1/checkpoint_best.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_refcoco/checkpoint_best.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_refcocog/checkpoint_best.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_refcocoplus/checkpoint_best.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_s1/checkpoint15.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_s2_hs/checkpoint1.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_vqa/checkpoint_best.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_video_caption_stage_1/checkpoint_best.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_video_caption_activitynet_stage_1/checkpoint_best.pt"
# change_name(ckpt_path, name)
# ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_video_vqa/checkpoint_best.pt"
# change_name(ckpt_path, name)
ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_video_vqa_msvd/checkpoint_best.pt"
change_name(ckpt_path, name)
ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_snli_ve/checkpoint_best.pt"
change_name(ckpt_path, name)
ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_audio_caption/checkpoint_best.pt"
change_name(ckpt_path, name)
ckpt_path = "/data/mshukor/logs/ofa/best_models/unival_audio_caption_clotho/checkpoint_best.pt"
change_name(ckpt_path, name)
|