zwt123home123 commited on
Commit
0580d34
·
verified ·
1 Parent(s): 2d8c4d1

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. attn_weights_7b/.ipynb_checkpoints/threshold2-checkpoint.py +50 -0
  2. attn_weights_7b/headmask_16.npy +3 -0
  3. attn_weights_7b/headmask_24.npy +3 -0
  4. attn_weights_7b/headmask_8.npy +3 -0
  5. attn_weights_7b/threshold2.py +50 -0
  6. attn_weights_7b/weights0/0.pth +3 -0
  7. attn_weights_7b/weights0/1.pth +3 -0
  8. attn_weights_7b/weights0/10.pth +3 -0
  9. attn_weights_7b/weights0/11.pth +3 -0
  10. attn_weights_7b/weights0/12.pth +3 -0
  11. attn_weights_7b/weights0/13.pth +3 -0
  12. attn_weights_7b/weights0/14.pth +3 -0
  13. attn_weights_7b/weights0/15.pth +3 -0
  14. attn_weights_7b/weights0/16.pth +3 -0
  15. attn_weights_7b/weights0/17.pth +3 -0
  16. attn_weights_7b/weights0/18.pth +3 -0
  17. attn_weights_7b/weights0/19.pth +3 -0
  18. attn_weights_7b/weights0/2.pth +3 -0
  19. attn_weights_7b/weights0/20.pth +3 -0
  20. attn_weights_7b/weights0/21.pth +3 -0
  21. attn_weights_7b/weights0/22.pth +3 -0
  22. attn_weights_7b/weights0/23.pth +3 -0
  23. attn_weights_7b/weights0/24.pth +3 -0
  24. attn_weights_7b/weights0/25.pth +3 -0
  25. attn_weights_7b/weights0/26.pth +3 -0
  26. attn_weights_7b/weights0/27.pth +3 -0
  27. attn_weights_7b/weights0/28.pth +3 -0
  28. attn_weights_7b/weights0/29.pth +3 -0
  29. attn_weights_7b/weights0/3.pth +3 -0
  30. attn_weights_7b/weights0/30.pth +3 -0
  31. attn_weights_7b/weights0/31.pth +3 -0
  32. attn_weights_7b/weights0/4.pth +3 -0
  33. attn_weights_7b/weights0/5.pth +3 -0
  34. attn_weights_7b/weights0/6.pth +3 -0
  35. attn_weights_7b/weights0/7.pth +3 -0
  36. attn_weights_7b/weights0/8.pth +3 -0
  37. attn_weights_7b/weights0/9.pth +3 -0
  38. attn_weights_7b/weights1/0.pth +3 -0
  39. attn_weights_7b/weights1/1.pth +3 -0
  40. attn_weights_7b/weights1/10.pth +3 -0
  41. attn_weights_7b/weights1/11.pth +3 -0
  42. attn_weights_7b/weights1/12.pth +3 -0
  43. attn_weights_7b/weights1/13.pth +3 -0
  44. attn_weights_7b/weights1/14.pth +3 -0
  45. attn_weights_7b/weights1/15.pth +3 -0
  46. attn_weights_7b/weights1/16.pth +3 -0
  47. attn_weights_7b/weights1/17.pth +3 -0
  48. attn_weights_7b/weights1/18.pth +3 -0
  49. attn_weights_7b/weights1/19.pth +3 -0
  50. attn_weights_7b/weights1/2.pth +3 -0
attn_weights_7b/.ipynb_checkpoints/threshold2-checkpoint.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import numpy as np
3
+ mask_lst=[]
4
+
5
+ mask_total = np.zeros((32, 32))
6
+ for layer_idx in range(32):
7
+ attn_weights_lst=[]
8
+ for i in range(4):
9
+ attn_weights_lst.append(torch.load("weights"+str(i)+"/"+str(layer_idx)+".pth"))
10
+
11
+ attn_weights = torch.cat(attn_weights_lst,dim=0)
12
+
13
+ for i in range(100):
14
+ res_v = torch.sum(attn_weights[i,:,:,35:35+576],dim=[1,2])
15
+ res_t = torch.sum(attn_weights[i,:,:,35+576:],dim=[1,2])
16
+ res_s = torch.sum(attn_weights[i,:,:,:35],dim=[1,2])
17
+ res = res_v/(res_t+res_s)
18
+ #mask = res>0.35 # headcut5
19
+ if layer_idx>=2:
20
+ mask = res>0.38 # headcut8: 0.38 headcut16: 0.11 headcut24: 0.044
21
+ else:
22
+ mask = res>=0
23
+ # mask = res>0.06 # headcut20
24
+ # mask = res>0.03 # headcut30
25
+ mask = mask.int()
26
+ # torch.save(mask,"temp/"+str(layer_idx)+".pth")
27
+ mask_total[layer_idx]+=mask.detach().cpu().numpy()
28
+ #import pdb; pdb.set_trace()
29
+ #mask_lst.append(mask)
30
+ #mask_lst.append(mask.sum().detach().cpu().numpy())
31
+
32
+ temp = mask_total>40 #headcut5 10 30
33
+
34
+ import pdb; pdb.set_trace()
35
+ print(mask_lst)
36
+ #print(np.mean(mask_lst))
37
+ '''
38
+ attn_weights_lst=[]
39
+ for i in range(4):
40
+ attn_weights_lst
41
+ for j in range(40):
42
+ attn_weights_lst.append(torch.load("weights"+))
43
+ attn_weights = torch.cat([attnweight1,attnweight2],dim=0)
44
+ res_v = torch.sum(attn_weights[:,:,:,35:35+576],dim=[0,2,3])
45
+ res_t = torch.sum( attn_weights[:,:,:,35+576:],dim=[0,2,3])
46
+ res_s = torch.sum( attn_weights[:,:,:,:35],dim=[0,2,3])
47
+ res = res_v/(res_t+res_s)
48
+ mask = res>0.12
49
+ import pdb; pdb.set_trace()
50
+ '''
attn_weights_7b/headmask_16.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c65c78107a6dcb61004d96307ec18332c82cba288d804effbfc43ca6cd69c9e
3
+ size 1152
attn_weights_7b/headmask_24.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:55065a9083bd01c96552f0768efc4107dcac450c23c8b78684c5edae00161462
3
+ size 1152
attn_weights_7b/headmask_8.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9a0e683c6ba78ea13923794555ae16ab4686537caa9dc23d3d8cdb09cc0ce54
3
+ size 1152
attn_weights_7b/threshold2.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import numpy as np
3
+ mask_lst=[]
4
+
5
+ mask_total = np.zeros((32, 32))
6
+ for layer_idx in range(32):
7
+ attn_weights_lst=[]
8
+ for i in range(4):
9
+ attn_weights_lst.append(torch.load("weights"+str(i)+"/"+str(layer_idx)+".pth"))
10
+
11
+ attn_weights = torch.cat(attn_weights_lst,dim=0)
12
+
13
+ for i in range(100):
14
+ res_v = torch.sum(attn_weights[i,:,:,35:35+576],dim=[1,2])
15
+ res_t = torch.sum(attn_weights[i,:,:,35+576:],dim=[1,2])
16
+ res_s = torch.sum(attn_weights[i,:,:,:35],dim=[1,2])
17
+ res = res_v/(res_t+res_s)
18
+ #mask = res>0.35 # headcut5
19
+ if layer_idx>=2:
20
+ mask = res>0.38 # headcut8: 0.38 headcut16: 0.11 headcut24: 0.044
21
+ else:
22
+ mask = res>=0
23
+ # mask = res>0.06 # headcut20
24
+ # mask = res>0.03 # headcut30
25
+ mask = mask.int()
26
+ # torch.save(mask,"temp/"+str(layer_idx)+".pth")
27
+ mask_total[layer_idx]+=mask.detach().cpu().numpy()
28
+ #import pdb; pdb.set_trace()
29
+ #mask_lst.append(mask)
30
+ #mask_lst.append(mask.sum().detach().cpu().numpy())
31
+
32
+ temp = mask_total>40 #headcut5 10 30
33
+
34
+ import pdb; pdb.set_trace()
35
+ print(mask_lst)
36
+ #print(np.mean(mask_lst))
37
+ '''
38
+ attn_weights_lst=[]
39
+ for i in range(4):
40
+ attn_weights_lst
41
+ for j in range(40):
42
+ attn_weights_lst.append(torch.load("weights"+))
43
+ attn_weights = torch.cat([attnweight1,attnweight2],dim=0)
44
+ res_v = torch.sum(attn_weights[:,:,:,35:35+576],dim=[0,2,3])
45
+ res_t = torch.sum( attn_weights[:,:,:,35+576:],dim=[0,2,3])
46
+ res_s = torch.sum( attn_weights[:,:,:,:35],dim=[0,2,3])
47
+ res = res_v/(res_t+res_s)
48
+ mask = res>0.12
49
+ import pdb; pdb.set_trace()
50
+ '''
attn_weights_7b/weights0/0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0bf564afa3f998f841feffa57ba77ad1c58ad98f5004b74e0cf8a21d39141b94
3
+ size 986622
attn_weights_7b/weights0/1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a5dbfe145c9e1b86dead004cef99b87667080abd351881ef08263663c629c8e
3
+ size 986622
attn_weights_7b/weights0/10.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f585e887fda80c4dafbb7bf1877ec7040d50fa6cbb78a3a7b3e0bfac2259156
3
+ size 986691
attn_weights_7b/weights0/11.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:332906a9b165653023df2fe8420554c4b5497a09d07bd46b4f0cfc79f3abc4a9
3
+ size 986691
attn_weights_7b/weights0/12.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:702d698521e2b5ad7785a590e29fde066de3f4a8336499003323cf7a63994ac2
3
+ size 986691
attn_weights_7b/weights0/13.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2321d5e3d9d85d93614629b0bf5f5b8477cb1d158c26bb4502d96c83fa5ad42
3
+ size 986691
attn_weights_7b/weights0/14.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a827bd69b9d3277212159f0b4349ef637761a4347ce0a96178ec7f3ccb242de
3
+ size 986691
attn_weights_7b/weights0/15.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e242ad7b7eaf5f6a86da0572a5a6e2477487402e41d1b5449fec312a9c3eb257
3
+ size 986691
attn_weights_7b/weights0/16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db4915c8c06219341f1917ac56e8125603a846eebcb444683c53ebb58b717484
3
+ size 986691
attn_weights_7b/weights0/17.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:554176cc5da8c1ae66fd903cdd48c22e206ebdbcfbb285416fc5a75bc5e0420e
3
+ size 986691
attn_weights_7b/weights0/18.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37243b983ffa8f833477a36c4a49c8f2793dc8e653846645a9eea903016ec117
3
+ size 986691
attn_weights_7b/weights0/19.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8322df3d08d86ebf1b813addcfe4972517b2a222dfb6f01df758ab95f51f452b
3
+ size 986691
attn_weights_7b/weights0/2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d33859a16d21ecfd48a7248a4ac5f7df926dec4df60190c66ac3c2524d03f19c
3
+ size 986622
attn_weights_7b/weights0/20.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c3d8e6eb08460b3b7a0f9fb1e45578f4e5c4057d64736d5a19595e410965e99
3
+ size 986691
attn_weights_7b/weights0/21.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b833d354885aed14fe84cc10ef11b42eefc2999d92dc30f06e8ba59fffb4567
3
+ size 986691
attn_weights_7b/weights0/22.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3bd0ef3eb8c68ccc64d0ab64cc2d6f63df23aef6c43741cc72e042f90c993a36
3
+ size 986691
attn_weights_7b/weights0/23.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:173b2e14f61d89c5506cd9c3e9e28f81ea7aa644c6a642a84ba4fb8c189643e0
3
+ size 986691
attn_weights_7b/weights0/24.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ae3b196d2f10a94c1e2495c3bc2ab40da6d92c849cfd844b8719f17ad86ce49
3
+ size 986691
attn_weights_7b/weights0/25.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4955277d328e82cf447a1ee41d58404d9cae0e704b87714bd95f382c5e1ab62
3
+ size 986691
attn_weights_7b/weights0/26.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c6e65a145fe07c65c3ec479737752dfc82ede0656cf5b5abc7e951bd63fd339
3
+ size 986691
attn_weights_7b/weights0/27.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c5bce1d57d3d4867090900d220703eea7c452e51ff77e34e27f4d633d6ffb59
3
+ size 986691
attn_weights_7b/weights0/28.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d1444abf7980531af9acd76360c2410e1d26aa760e01158b61bad0c64a173bd
3
+ size 986691
attn_weights_7b/weights0/29.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9450e16b11ca367156f9a913036e6c42e6ef4786a804fd8be4686abdd6eecc07
3
+ size 986691
attn_weights_7b/weights0/3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29fc976400f762ce91b2574ec4631d6b1971de72795fc0401293d1a66f8b7f19
3
+ size 986622
attn_weights_7b/weights0/30.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1181cf3eb9d93173cf181da675960b1e847ec764e48c74170fe7354553a6d0f
3
+ size 986691
attn_weights_7b/weights0/31.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b027c9499e385ef1c264690136d9c0baa5312b27e55c9cde7c63a620e9ddfb0b
3
+ size 986691
attn_weights_7b/weights0/4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac760c6dfe541ea35a012b439a0e2fd6079a79815203c476fa93a45f2329137f
3
+ size 986622
attn_weights_7b/weights0/5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f5ff79d81258afdd7297f039d7160bde83ce972f621ffdfb6ce79265647d0cd
3
+ size 986622
attn_weights_7b/weights0/6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ff07a0aa4430763523279b77b21f5d283efbdd151ddc8130628794f2c00106e
3
+ size 986622
attn_weights_7b/weights0/7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d33f75b51fb180bae1fa7398eff72f85ee4eae2b18e82e8cb889133eaa51690c
3
+ size 986622
attn_weights_7b/weights0/8.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3a5110c5f1cd827ae29a978630932306d8b3b4143871f5650c5c2547f02866f
3
+ size 986622
attn_weights_7b/weights0/9.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bb5b874c626cd1639f8d47f148b841a1bca4289cd8ed1ba891d564b2dfef27a
3
+ size 986622
attn_weights_7b/weights1/0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d64538f185a728501fdb1023c11e53f4fc321a4e933f070155a87bce839fc455
3
+ size 986622
attn_weights_7b/weights1/1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f966bff6b9c6497a04ac2f74309674e6aa35882de1cc15185d199940672d4e9
3
+ size 986622
attn_weights_7b/weights1/10.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78311bf7297588874ef35cec86747422d8cd93b86651b870c25eb77c5078827b
3
+ size 986691
attn_weights_7b/weights1/11.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:725c7c3960e98e59964b9144bbeebb898235607f70281c24873ed00fc12214be
3
+ size 986691
attn_weights_7b/weights1/12.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:135bdcb6184a18a16cfc0b9dce57227fe2f39481198fb688235a07b86499bd5b
3
+ size 986691
attn_weights_7b/weights1/13.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:201ade58b309853636bb15910e9e9e42631e300aac813f2f79c8e4f9028a34cf
3
+ size 986691
attn_weights_7b/weights1/14.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d566f50fc597f0fff76e07db82c0141af21c7a951ab88a2d5a7c6ee637dc1fc1
3
+ size 986691
attn_weights_7b/weights1/15.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a85f55ff93a5ab2a9632f7aa0a99168e12cba24ed70c0a6fa9f004f872b097f8
3
+ size 986691
attn_weights_7b/weights1/16.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba0373a20059b25b67e9d72f5409a57392d5bcf1fb74ae2dacd0e636c0a85d4d
3
+ size 986691
attn_weights_7b/weights1/17.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:866102ceb1725a7c388c1aab55dcd6b47a20f668c8b74ff4c2c36af1e8608523
3
+ size 986691
attn_weights_7b/weights1/18.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33a94daced0b0be0dea7a53dea38d744312c64e9c58a462819fe9a6c56f37436
3
+ size 986691
attn_weights_7b/weights1/19.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6aae4a712add8ad994f063973d49a8e48d5e03f2a3bfc7f52accd9ceab774cca
3
+ size 986691
attn_weights_7b/weights1/2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f255eb3426866812885094cd4905def4f4aa9bc8c530e50bf7393ad0ad5cdf9
3
+ size 986622