noamrot commited on
Commit
6a5a81b
·
1 Parent(s): 6a946c6
Files changed (1) hide show
  1. tmp.py +0 -18
tmp.py DELETED
@@ -1,18 +0,0 @@
1
- import torch
2
-
3
- # Load old model weights
4
- old_weights = torch.load('/Users/snoamr/Documents/superCap/huggingface_model_card/FuseCap/pytorch_model.bin', map_location=torch.device('cpu'))
5
-
6
- # Prepare a dictionary to hold the new weights
7
- new_weights = {}
8
-
9
- # Loop over the items in old_weights
10
- for name, weight in old_weights.items():
11
- # Replace the old model's layer names with the new model's layer names
12
- new_name = name.replace('vision_model.encoder.layers', 'visual_encoder.blocks')
13
-
14
- # Add the modified name and associated weight to new_weights
15
- new_weights[new_name] = weight
16
-
17
- # Save the new weights
18
- torch.save(new_weights, '/Users/snoamr/Documents/superCap/huggingface_model_card/FuseCap/pytorch_model_new.bin')