ZwwWayne
commited on
Commit
•
e2955f1
1
Parent(s):
a726bdd
use bin instead of safetensors with max shard of 2GB
Browse files- .gitattributes +22 -4
- config.json +2 -2
- generation_config.json +1 -1
- model.safetensors.index.json +0 -346
- modeling_internlm2.py +14 -18
- model-00001-of-00004.safetensors → pytorch_model-00001-of-00021.bin +2 -2
- model-00002-of-00004.safetensors → pytorch_model-00002-of-00021.bin +2 -2
- model-00003-of-00004.safetensors → pytorch_model-00003-of-00021.bin +2 -2
- model-00004-of-00004.safetensors → pytorch_model-00004-of-00021.bin +2 -2
- pytorch_model-00005-of-00021.bin +3 -0
- pytorch_model-00006-of-00021.bin +3 -0
- pytorch_model-00007-of-00021.bin +3 -0
- pytorch_model-00008-of-00021.bin +3 -0
- pytorch_model-00009-of-00021.bin +3 -0
- pytorch_model-00010-of-00021.bin +3 -0
- pytorch_model-00011-of-00021.bin +3 -0
- pytorch_model-00012-of-00021.bin +3 -0
- pytorch_model-00013-of-00021.bin +3 -0
- pytorch_model-00014-of-00021.bin +3 -0
- pytorch_model-00015-of-00021.bin +3 -0
- pytorch_model-00016-of-00021.bin +3 -0
- pytorch_model-00017-of-00021.bin +3 -0
- pytorch_model-00018-of-00021.bin +3 -0
- pytorch_model-00019-of-00021.bin +3 -0
- pytorch_model-00020-of-00021.bin +3 -0
- pytorch_model-00021-of-00021.bin +3 -0
- pytorch_model.bin.index.json +3 -0
- tokenizer_config.json +0 -26
.gitattributes
CHANGED
@@ -33,8 +33,26 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
-
model-00001-of-00004.safetensors filter=lfs diff=lfs merge=lfs -text
|
37 |
-
model-00002-of-00004.safetensors filter=lfs diff=lfs merge=lfs -text
|
38 |
-
model-00003-of-00004.safetensors filter=lfs diff=lfs merge=lfs -text
|
39 |
-
model-00004-of-00004.safetensors filter=lfs diff=lfs merge=lfs -text
|
40 |
tokenizer.model filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
36 |
tokenizer.model filter=lfs diff=lfs merge=lfs -text
|
37 |
+
pytorch_model-00013-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
38 |
+
pytorch_model-00017-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
39 |
+
pytorch_model-00001-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
40 |
+
pytorch_model-00002-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
41 |
+
pytorch_model-00006-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
42 |
+
pytorch_model-00008-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
43 |
+
pytorch_model.bin.index.json filter=lfs diff=lfs merge=lfs -text
|
44 |
+
pytorch_model-00010-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
45 |
+
pytorch_model-00016-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
46 |
+
pytorch_model-00018-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
47 |
+
pytorch_model-00020-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
48 |
+
pytorch_model-00003-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
49 |
+
pytorch_model-00007-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
50 |
+
pytorch_model-00011-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
51 |
+
pytorch_model-00021-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
52 |
+
pytorch_model-00014-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
53 |
+
pytorch_model-00015-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
54 |
+
pytorch_model-00019-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
55 |
+
pytorch_model-00004-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
56 |
+
pytorch_model-00005-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
57 |
+
pytorch_model-00009-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
58 |
+
pytorch_model-00012-of-00021.bin filter=lfs diff=lfs merge=lfs -text
|
config.json
CHANGED
@@ -27,8 +27,8 @@
|
|
27 |
},
|
28 |
"rope_theta": 1000000,
|
29 |
"tie_word_embeddings": false,
|
30 |
-
"torch_dtype": "
|
31 |
-
"transformers_version": "4.
|
32 |
"use_cache": true,
|
33 |
"vocab_size": 92544
|
34 |
}
|
|
|
27 |
},
|
28 |
"rope_theta": 1000000,
|
29 |
"tie_word_embeddings": false,
|
30 |
+
"torch_dtype": "float16",
|
31 |
+
"transformers_version": "4.33.2",
|
32 |
"use_cache": true,
|
33 |
"vocab_size": 92544
|
34 |
}
|
generation_config.json
CHANGED
@@ -3,5 +3,5 @@
|
|
3 |
"bos_token_id": 1,
|
4 |
"eos_token_id": 2,
|
5 |
"pad_token_id": 2,
|
6 |
-
"transformers_version": "4.
|
7 |
}
|
|
|
3 |
"bos_token_id": 1,
|
4 |
"eos_token_id": 2,
|
5 |
"pad_token_id": 2,
|
6 |
+
"transformers_version": "4.33.2"
|
7 |
}
|
model.safetensors.index.json
DELETED
@@ -1,346 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"metadata": {
|
3 |
-
"total_size": 39722299392
|
4 |
-
},
|
5 |
-
"weight_map": {
|
6 |
-
"model.layers.0.attention.wo.weight": "model-00001-of-00004.safetensors",
|
7 |
-
"model.layers.0.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
8 |
-
"model.layers.0.attention_norm.weight": "model-00001-of-00004.safetensors",
|
9 |
-
"model.layers.0.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
10 |
-
"model.layers.0.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
11 |
-
"model.layers.0.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
12 |
-
"model.layers.0.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
13 |
-
"model.layers.1.attention.wo.weight": "model-00001-of-00004.safetensors",
|
14 |
-
"model.layers.1.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
15 |
-
"model.layers.1.attention_norm.weight": "model-00001-of-00004.safetensors",
|
16 |
-
"model.layers.1.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
17 |
-
"model.layers.1.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
18 |
-
"model.layers.1.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
19 |
-
"model.layers.1.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
20 |
-
"model.layers.10.attention.wo.weight": "model-00001-of-00004.safetensors",
|
21 |
-
"model.layers.10.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
22 |
-
"model.layers.10.attention_norm.weight": "model-00001-of-00004.safetensors",
|
23 |
-
"model.layers.10.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
24 |
-
"model.layers.10.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
25 |
-
"model.layers.10.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
26 |
-
"model.layers.10.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
27 |
-
"model.layers.11.attention.wo.weight": "model-00001-of-00004.safetensors",
|
28 |
-
"model.layers.11.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
29 |
-
"model.layers.11.attention_norm.weight": "model-00002-of-00004.safetensors",
|
30 |
-
"model.layers.11.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
31 |
-
"model.layers.11.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
32 |
-
"model.layers.11.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
33 |
-
"model.layers.11.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
34 |
-
"model.layers.12.attention.wo.weight": "model-00002-of-00004.safetensors",
|
35 |
-
"model.layers.12.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
36 |
-
"model.layers.12.attention_norm.weight": "model-00002-of-00004.safetensors",
|
37 |
-
"model.layers.12.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
38 |
-
"model.layers.12.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
39 |
-
"model.layers.12.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
40 |
-
"model.layers.12.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
41 |
-
"model.layers.13.attention.wo.weight": "model-00002-of-00004.safetensors",
|
42 |
-
"model.layers.13.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
43 |
-
"model.layers.13.attention_norm.weight": "model-00002-of-00004.safetensors",
|
44 |
-
"model.layers.13.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
45 |
-
"model.layers.13.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
46 |
-
"model.layers.13.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
47 |
-
"model.layers.13.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
48 |
-
"model.layers.14.attention.wo.weight": "model-00002-of-00004.safetensors",
|
49 |
-
"model.layers.14.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
50 |
-
"model.layers.14.attention_norm.weight": "model-00002-of-00004.safetensors",
|
51 |
-
"model.layers.14.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
52 |
-
"model.layers.14.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
53 |
-
"model.layers.14.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
54 |
-
"model.layers.14.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
55 |
-
"model.layers.15.attention.wo.weight": "model-00002-of-00004.safetensors",
|
56 |
-
"model.layers.15.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
57 |
-
"model.layers.15.attention_norm.weight": "model-00002-of-00004.safetensors",
|
58 |
-
"model.layers.15.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
59 |
-
"model.layers.15.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
60 |
-
"model.layers.15.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
61 |
-
"model.layers.15.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
62 |
-
"model.layers.16.attention.wo.weight": "model-00002-of-00004.safetensors",
|
63 |
-
"model.layers.16.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
64 |
-
"model.layers.16.attention_norm.weight": "model-00002-of-00004.safetensors",
|
65 |
-
"model.layers.16.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
66 |
-
"model.layers.16.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
67 |
-
"model.layers.16.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
68 |
-
"model.layers.16.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
69 |
-
"model.layers.17.attention.wo.weight": "model-00002-of-00004.safetensors",
|
70 |
-
"model.layers.17.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
71 |
-
"model.layers.17.attention_norm.weight": "model-00002-of-00004.safetensors",
|
72 |
-
"model.layers.17.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
73 |
-
"model.layers.17.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
74 |
-
"model.layers.17.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
75 |
-
"model.layers.17.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
76 |
-
"model.layers.18.attention.wo.weight": "model-00002-of-00004.safetensors",
|
77 |
-
"model.layers.18.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
78 |
-
"model.layers.18.attention_norm.weight": "model-00002-of-00004.safetensors",
|
79 |
-
"model.layers.18.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
80 |
-
"model.layers.18.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
81 |
-
"model.layers.18.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
82 |
-
"model.layers.18.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
83 |
-
"model.layers.19.attention.wo.weight": "model-00002-of-00004.safetensors",
|
84 |
-
"model.layers.19.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
85 |
-
"model.layers.19.attention_norm.weight": "model-00002-of-00004.safetensors",
|
86 |
-
"model.layers.19.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
87 |
-
"model.layers.19.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
88 |
-
"model.layers.19.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
89 |
-
"model.layers.19.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
90 |
-
"model.layers.2.attention.wo.weight": "model-00001-of-00004.safetensors",
|
91 |
-
"model.layers.2.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
92 |
-
"model.layers.2.attention_norm.weight": "model-00001-of-00004.safetensors",
|
93 |
-
"model.layers.2.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
94 |
-
"model.layers.2.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
95 |
-
"model.layers.2.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
96 |
-
"model.layers.2.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
97 |
-
"model.layers.20.attention.wo.weight": "model-00002-of-00004.safetensors",
|
98 |
-
"model.layers.20.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
99 |
-
"model.layers.20.attention_norm.weight": "model-00002-of-00004.safetensors",
|
100 |
-
"model.layers.20.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
101 |
-
"model.layers.20.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
102 |
-
"model.layers.20.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
103 |
-
"model.layers.20.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
104 |
-
"model.layers.21.attention.wo.weight": "model-00002-of-00004.safetensors",
|
105 |
-
"model.layers.21.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
106 |
-
"model.layers.21.attention_norm.weight": "model-00002-of-00004.safetensors",
|
107 |
-
"model.layers.21.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
108 |
-
"model.layers.21.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
109 |
-
"model.layers.21.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
110 |
-
"model.layers.21.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
111 |
-
"model.layers.22.attention.wo.weight": "model-00002-of-00004.safetensors",
|
112 |
-
"model.layers.22.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
113 |
-
"model.layers.22.attention_norm.weight": "model-00002-of-00004.safetensors",
|
114 |
-
"model.layers.22.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
115 |
-
"model.layers.22.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
116 |
-
"model.layers.22.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
117 |
-
"model.layers.22.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
118 |
-
"model.layers.23.attention.wo.weight": "model-00002-of-00004.safetensors",
|
119 |
-
"model.layers.23.attention.wqkv.weight": "model-00002-of-00004.safetensors",
|
120 |
-
"model.layers.23.attention_norm.weight": "model-00002-of-00004.safetensors",
|
121 |
-
"model.layers.23.feed_forward.w1.weight": "model-00002-of-00004.safetensors",
|
122 |
-
"model.layers.23.feed_forward.w2.weight": "model-00002-of-00004.safetensors",
|
123 |
-
"model.layers.23.feed_forward.w3.weight": "model-00002-of-00004.safetensors",
|
124 |
-
"model.layers.23.ffn_norm.weight": "model-00002-of-00004.safetensors",
|
125 |
-
"model.layers.24.attention.wo.weight": "model-00003-of-00004.safetensors",
|
126 |
-
"model.layers.24.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
127 |
-
"model.layers.24.attention_norm.weight": "model-00003-of-00004.safetensors",
|
128 |
-
"model.layers.24.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
129 |
-
"model.layers.24.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
130 |
-
"model.layers.24.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
131 |
-
"model.layers.24.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
132 |
-
"model.layers.25.attention.wo.weight": "model-00003-of-00004.safetensors",
|
133 |
-
"model.layers.25.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
134 |
-
"model.layers.25.attention_norm.weight": "model-00003-of-00004.safetensors",
|
135 |
-
"model.layers.25.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
136 |
-
"model.layers.25.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
137 |
-
"model.layers.25.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
138 |
-
"model.layers.25.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
139 |
-
"model.layers.26.attention.wo.weight": "model-00003-of-00004.safetensors",
|
140 |
-
"model.layers.26.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
141 |
-
"model.layers.26.attention_norm.weight": "model-00003-of-00004.safetensors",
|
142 |
-
"model.layers.26.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
143 |
-
"model.layers.26.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
144 |
-
"model.layers.26.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
145 |
-
"model.layers.26.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
146 |
-
"model.layers.27.attention.wo.weight": "model-00003-of-00004.safetensors",
|
147 |
-
"model.layers.27.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
148 |
-
"model.layers.27.attention_norm.weight": "model-00003-of-00004.safetensors",
|
149 |
-
"model.layers.27.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
150 |
-
"model.layers.27.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
151 |
-
"model.layers.27.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
152 |
-
"model.layers.27.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
153 |
-
"model.layers.28.attention.wo.weight": "model-00003-of-00004.safetensors",
|
154 |
-
"model.layers.28.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
155 |
-
"model.layers.28.attention_norm.weight": "model-00003-of-00004.safetensors",
|
156 |
-
"model.layers.28.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
157 |
-
"model.layers.28.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
158 |
-
"model.layers.28.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
159 |
-
"model.layers.28.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
160 |
-
"model.layers.29.attention.wo.weight": "model-00003-of-00004.safetensors",
|
161 |
-
"model.layers.29.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
162 |
-
"model.layers.29.attention_norm.weight": "model-00003-of-00004.safetensors",
|
163 |
-
"model.layers.29.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
164 |
-
"model.layers.29.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
165 |
-
"model.layers.29.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
166 |
-
"model.layers.29.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
167 |
-
"model.layers.3.attention.wo.weight": "model-00001-of-00004.safetensors",
|
168 |
-
"model.layers.3.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
169 |
-
"model.layers.3.attention_norm.weight": "model-00001-of-00004.safetensors",
|
170 |
-
"model.layers.3.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
171 |
-
"model.layers.3.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
172 |
-
"model.layers.3.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
173 |
-
"model.layers.3.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
174 |
-
"model.layers.30.attention.wo.weight": "model-00003-of-00004.safetensors",
|
175 |
-
"model.layers.30.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
176 |
-
"model.layers.30.attention_norm.weight": "model-00003-of-00004.safetensors",
|
177 |
-
"model.layers.30.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
178 |
-
"model.layers.30.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
179 |
-
"model.layers.30.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
180 |
-
"model.layers.30.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
181 |
-
"model.layers.31.attention.wo.weight": "model-00003-of-00004.safetensors",
|
182 |
-
"model.layers.31.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
183 |
-
"model.layers.31.attention_norm.weight": "model-00003-of-00004.safetensors",
|
184 |
-
"model.layers.31.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
185 |
-
"model.layers.31.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
186 |
-
"model.layers.31.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
187 |
-
"model.layers.31.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
188 |
-
"model.layers.32.attention.wo.weight": "model-00003-of-00004.safetensors",
|
189 |
-
"model.layers.32.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
190 |
-
"model.layers.32.attention_norm.weight": "model-00003-of-00004.safetensors",
|
191 |
-
"model.layers.32.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
192 |
-
"model.layers.32.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
193 |
-
"model.layers.32.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
194 |
-
"model.layers.32.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
195 |
-
"model.layers.33.attention.wo.weight": "model-00003-of-00004.safetensors",
|
196 |
-
"model.layers.33.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
197 |
-
"model.layers.33.attention_norm.weight": "model-00003-of-00004.safetensors",
|
198 |
-
"model.layers.33.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
199 |
-
"model.layers.33.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
200 |
-
"model.layers.33.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
201 |
-
"model.layers.33.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
202 |
-
"model.layers.34.attention.wo.weight": "model-00003-of-00004.safetensors",
|
203 |
-
"model.layers.34.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
204 |
-
"model.layers.34.attention_norm.weight": "model-00003-of-00004.safetensors",
|
205 |
-
"model.layers.34.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
206 |
-
"model.layers.34.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
207 |
-
"model.layers.34.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
208 |
-
"model.layers.34.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
209 |
-
"model.layers.35.attention.wo.weight": "model-00003-of-00004.safetensors",
|
210 |
-
"model.layers.35.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
211 |
-
"model.layers.35.attention_norm.weight": "model-00003-of-00004.safetensors",
|
212 |
-
"model.layers.35.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
213 |
-
"model.layers.35.feed_forward.w2.weight": "model-00003-of-00004.safetensors",
|
214 |
-
"model.layers.35.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
215 |
-
"model.layers.35.ffn_norm.weight": "model-00003-of-00004.safetensors",
|
216 |
-
"model.layers.36.attention.wo.weight": "model-00003-of-00004.safetensors",
|
217 |
-
"model.layers.36.attention.wqkv.weight": "model-00003-of-00004.safetensors",
|
218 |
-
"model.layers.36.attention_norm.weight": "model-00004-of-00004.safetensors",
|
219 |
-
"model.layers.36.feed_forward.w1.weight": "model-00003-of-00004.safetensors",
|
220 |
-
"model.layers.36.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
221 |
-
"model.layers.36.feed_forward.w3.weight": "model-00003-of-00004.safetensors",
|
222 |
-
"model.layers.36.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
223 |
-
"model.layers.37.attention.wo.weight": "model-00004-of-00004.safetensors",
|
224 |
-
"model.layers.37.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
225 |
-
"model.layers.37.attention_norm.weight": "model-00004-of-00004.safetensors",
|
226 |
-
"model.layers.37.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
227 |
-
"model.layers.37.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
228 |
-
"model.layers.37.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
229 |
-
"model.layers.37.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
230 |
-
"model.layers.38.attention.wo.weight": "model-00004-of-00004.safetensors",
|
231 |
-
"model.layers.38.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
232 |
-
"model.layers.38.attention_norm.weight": "model-00004-of-00004.safetensors",
|
233 |
-
"model.layers.38.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
234 |
-
"model.layers.38.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
235 |
-
"model.layers.38.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
236 |
-
"model.layers.38.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
237 |
-
"model.layers.39.attention.wo.weight": "model-00004-of-00004.safetensors",
|
238 |
-
"model.layers.39.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
239 |
-
"model.layers.39.attention_norm.weight": "model-00004-of-00004.safetensors",
|
240 |
-
"model.layers.39.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
241 |
-
"model.layers.39.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
242 |
-
"model.layers.39.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
243 |
-
"model.layers.39.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
244 |
-
"model.layers.4.attention.wo.weight": "model-00001-of-00004.safetensors",
|
245 |
-
"model.layers.4.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
246 |
-
"model.layers.4.attention_norm.weight": "model-00001-of-00004.safetensors",
|
247 |
-
"model.layers.4.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
248 |
-
"model.layers.4.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
249 |
-
"model.layers.4.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
250 |
-
"model.layers.4.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
251 |
-
"model.layers.40.attention.wo.weight": "model-00004-of-00004.safetensors",
|
252 |
-
"model.layers.40.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
253 |
-
"model.layers.40.attention_norm.weight": "model-00004-of-00004.safetensors",
|
254 |
-
"model.layers.40.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
255 |
-
"model.layers.40.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
256 |
-
"model.layers.40.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
257 |
-
"model.layers.40.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
258 |
-
"model.layers.41.attention.wo.weight": "model-00004-of-00004.safetensors",
|
259 |
-
"model.layers.41.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
260 |
-
"model.layers.41.attention_norm.weight": "model-00004-of-00004.safetensors",
|
261 |
-
"model.layers.41.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
262 |
-
"model.layers.41.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
263 |
-
"model.layers.41.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
264 |
-
"model.layers.41.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
265 |
-
"model.layers.42.attention.wo.weight": "model-00004-of-00004.safetensors",
|
266 |
-
"model.layers.42.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
267 |
-
"model.layers.42.attention_norm.weight": "model-00004-of-00004.safetensors",
|
268 |
-
"model.layers.42.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
269 |
-
"model.layers.42.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
270 |
-
"model.layers.42.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
271 |
-
"model.layers.42.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
272 |
-
"model.layers.43.attention.wo.weight": "model-00004-of-00004.safetensors",
|
273 |
-
"model.layers.43.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
274 |
-
"model.layers.43.attention_norm.weight": "model-00004-of-00004.safetensors",
|
275 |
-
"model.layers.43.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
276 |
-
"model.layers.43.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
277 |
-
"model.layers.43.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
278 |
-
"model.layers.43.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
279 |
-
"model.layers.44.attention.wo.weight": "model-00004-of-00004.safetensors",
|
280 |
-
"model.layers.44.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
281 |
-
"model.layers.44.attention_norm.weight": "model-00004-of-00004.safetensors",
|
282 |
-
"model.layers.44.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
283 |
-
"model.layers.44.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
284 |
-
"model.layers.44.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
285 |
-
"model.layers.44.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
286 |
-
"model.layers.45.attention.wo.weight": "model-00004-of-00004.safetensors",
|
287 |
-
"model.layers.45.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
288 |
-
"model.layers.45.attention_norm.weight": "model-00004-of-00004.safetensors",
|
289 |
-
"model.layers.45.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
290 |
-
"model.layers.45.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
291 |
-
"model.layers.45.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
292 |
-
"model.layers.45.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
293 |
-
"model.layers.46.attention.wo.weight": "model-00004-of-00004.safetensors",
|
294 |
-
"model.layers.46.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
295 |
-
"model.layers.46.attention_norm.weight": "model-00004-of-00004.safetensors",
|
296 |
-
"model.layers.46.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
297 |
-
"model.layers.46.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
298 |
-
"model.layers.46.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
299 |
-
"model.layers.46.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
300 |
-
"model.layers.47.attention.wo.weight": "model-00004-of-00004.safetensors",
|
301 |
-
"model.layers.47.attention.wqkv.weight": "model-00004-of-00004.safetensors",
|
302 |
-
"model.layers.47.attention_norm.weight": "model-00004-of-00004.safetensors",
|
303 |
-
"model.layers.47.feed_forward.w1.weight": "model-00004-of-00004.safetensors",
|
304 |
-
"model.layers.47.feed_forward.w2.weight": "model-00004-of-00004.safetensors",
|
305 |
-
"model.layers.47.feed_forward.w3.weight": "model-00004-of-00004.safetensors",
|
306 |
-
"model.layers.47.ffn_norm.weight": "model-00004-of-00004.safetensors",
|
307 |
-
"model.layers.5.attention.wo.weight": "model-00001-of-00004.safetensors",
|
308 |
-
"model.layers.5.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
309 |
-
"model.layers.5.attention_norm.weight": "model-00001-of-00004.safetensors",
|
310 |
-
"model.layers.5.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
311 |
-
"model.layers.5.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
312 |
-
"model.layers.5.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
313 |
-
"model.layers.5.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
314 |
-
"model.layers.6.attention.wo.weight": "model-00001-of-00004.safetensors",
|
315 |
-
"model.layers.6.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
316 |
-
"model.layers.6.attention_norm.weight": "model-00001-of-00004.safetensors",
|
317 |
-
"model.layers.6.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
318 |
-
"model.layers.6.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
319 |
-
"model.layers.6.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
320 |
-
"model.layers.6.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
321 |
-
"model.layers.7.attention.wo.weight": "model-00001-of-00004.safetensors",
|
322 |
-
"model.layers.7.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
323 |
-
"model.layers.7.attention_norm.weight": "model-00001-of-00004.safetensors",
|
324 |
-
"model.layers.7.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
325 |
-
"model.layers.7.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
326 |
-
"model.layers.7.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
327 |
-
"model.layers.7.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
328 |
-
"model.layers.8.attention.wo.weight": "model-00001-of-00004.safetensors",
|
329 |
-
"model.layers.8.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
330 |
-
"model.layers.8.attention_norm.weight": "model-00001-of-00004.safetensors",
|
331 |
-
"model.layers.8.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
332 |
-
"model.layers.8.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
333 |
-
"model.layers.8.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
334 |
-
"model.layers.8.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
335 |
-
"model.layers.9.attention.wo.weight": "model-00001-of-00004.safetensors",
|
336 |
-
"model.layers.9.attention.wqkv.weight": "model-00001-of-00004.safetensors",
|
337 |
-
"model.layers.9.attention_norm.weight": "model-00001-of-00004.safetensors",
|
338 |
-
"model.layers.9.feed_forward.w1.weight": "model-00001-of-00004.safetensors",
|
339 |
-
"model.layers.9.feed_forward.w2.weight": "model-00001-of-00004.safetensors",
|
340 |
-
"model.layers.9.feed_forward.w3.weight": "model-00001-of-00004.safetensors",
|
341 |
-
"model.layers.9.ffn_norm.weight": "model-00001-of-00004.safetensors",
|
342 |
-
"model.norm.weight": "model-00004-of-00004.safetensors",
|
343 |
-
"model.tok_embeddings.weight": "model-00001-of-00004.safetensors",
|
344 |
-
"output.weight": "model-00004-of-00004.safetensors"
|
345 |
-
}
|
346 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modeling_internlm2.py
CHANGED
@@ -133,7 +133,7 @@ class InternLM2RotaryEmbedding(nn.Module):
|
|
133 |
def forward(self, x, seq_len=None):
|
134 |
# x: [bs, num_attention_heads, seq_len, head_size]
|
135 |
if seq_len > self.max_seq_len_cached:
|
136 |
-
self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=
|
137 |
|
138 |
return (
|
139 |
self.cos_cached[:seq_len].to(dtype=x.dtype),
|
@@ -196,20 +196,10 @@ def rotate_half(x):
|
|
196 |
|
197 |
|
198 |
def apply_rotary_pos_emb(q, k, cos, sin, position_ids):
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
sin = sin.unsqueeze(0).unsqueeze(0).expand(len(position_ids), -1, -1, -1)
|
204 |
-
if q.size(2) == 1:
|
205 |
-
q_embed = (q * cos[:, :, -1, :]) + (rotate_half(q) * sin[:, :, -1, :])
|
206 |
-
else:
|
207 |
-
q_embed = (q * cos) + (rotate_half(q) * sin)
|
208 |
-
|
209 |
-
if k.size(2) == 1:
|
210 |
-
k_embed = (k * cos[:, :, -1, :]) + (rotate_half(k) * sin[:, :, -1, :])
|
211 |
-
else:
|
212 |
-
k_embed = (k * cos) + (rotate_half(k) * sin)
|
213 |
|
214 |
return q_embed, k_embed
|
215 |
|
@@ -289,8 +279,15 @@ class InternLM2Attention(nn.Module):
|
|
289 |
base=self.config.rope_theta,
|
290 |
scaling_factor=scaling_factor
|
291 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
else:
|
293 |
-
raise ValueError("Currently we only support rotary embedding's type being 'dynamic'.")
|
294 |
return self.rotary_emb
|
295 |
|
296 |
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
|
@@ -1032,7 +1029,6 @@ class InternLM2ForCausalLM(InternLM2PreTrainedModel):
|
|
1032 |
for record in history:
|
1033 |
prompt += f"""[UNUSED_TOKEN_146]user\n{record[0]}[UNUSED_TOKEN_145]\n[UNUSED_TOKEN_146]assistant\n{record[1]}[UNUSED_TOKEN_145]\n"""
|
1034 |
prompt += f"""[UNUSED_TOKEN_146]user\n{query}[UNUSED_TOKEN_145]\n[UNUSED_TOKEN_146]assistant\n"""
|
1035 |
-
print(prompt)
|
1036 |
return tokenizer([prompt], return_tensors="pt")
|
1037 |
|
1038 |
@torch.no_grad()
|
@@ -1268,5 +1264,5 @@ class InternLM2ForSequenceClassification(InternLM2PreTrainedModel):
|
|
1268 |
logits=pooled_logits,
|
1269 |
past_key_values=transformer_outputs.past_key_values,
|
1270 |
hidden_states=transformer_outputs.hidden_states,
|
1271 |
-
attentions=transformer_outputs,
|
1272 |
)
|
|
|
133 |
def forward(self, x, seq_len=None):
|
134 |
# x: [bs, num_attention_heads, seq_len, head_size]
|
135 |
if seq_len > self.max_seq_len_cached:
|
136 |
+
self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=torch.float32)
|
137 |
|
138 |
return (
|
139 |
self.cos_cached[:seq_len].to(dtype=x.dtype),
|
|
|
196 |
|
197 |
|
198 |
def apply_rotary_pos_emb(q, k, cos, sin, position_ids):
|
199 |
+
cos = cos[position_ids].unsqueeze(1)
|
200 |
+
sin = sin[position_ids].unsqueeze(1)
|
201 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
202 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
return q_embed, k_embed
|
205 |
|
|
|
279 |
base=self.config.rope_theta,
|
280 |
scaling_factor=scaling_factor
|
281 |
)
|
282 |
+
elif scaling_type == "linear":
|
283 |
+
self.rotary_emb = InternLM2LinearScalingRotaryEmbedding(
|
284 |
+
self.head_dim,
|
285 |
+
max_position_embeddings=self.max_position_embeddings,
|
286 |
+
base=self.config.rope_theta,
|
287 |
+
scaling_factor=scaling_factor
|
288 |
+
)
|
289 |
else:
|
290 |
+
raise ValueError("Currently we only support rotary embedding's type being 'dynamic' or 'linear'.")
|
291 |
return self.rotary_emb
|
292 |
|
293 |
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
|
|
|
1029 |
for record in history:
|
1030 |
prompt += f"""[UNUSED_TOKEN_146]user\n{record[0]}[UNUSED_TOKEN_145]\n[UNUSED_TOKEN_146]assistant\n{record[1]}[UNUSED_TOKEN_145]\n"""
|
1031 |
prompt += f"""[UNUSED_TOKEN_146]user\n{query}[UNUSED_TOKEN_145]\n[UNUSED_TOKEN_146]assistant\n"""
|
|
|
1032 |
return tokenizer([prompt], return_tensors="pt")
|
1033 |
|
1034 |
@torch.no_grad()
|
|
|
1264 |
logits=pooled_logits,
|
1265 |
past_key_values=transformer_outputs.past_key_values,
|
1266 |
hidden_states=transformer_outputs.hidden_states,
|
1267 |
+
attentions=transformer_outputs.attentions,
|
1268 |
)
|
model-00001-of-00004.safetensors → pytorch_model-00001-of-00021.bin
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:722819f7b217898ee32c8c65421006303081106b7af8048378774423de824f26
|
3 |
+
size 1917348897
|
model-00002-of-00004.safetensors → pytorch_model-00002-of-00021.bin
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8d4ee6af265497cbd169c7163f0e9ac97c56e389c7a89f825713894ff3120fee
|
3 |
+
size 1937823489
|
model-00003-of-00004.safetensors → pytorch_model-00003-of-00021.bin
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fc0d11d9813cea7bba73cfbcc0e212fff344e7282adb370fdfb20adfda9f164a
|
3 |
+
size 1963014163
|
model-00004-of-00004.safetensors → pytorch_model-00004-of-00021.bin
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:aa74f5be136e888c2a7c43032bd97dca226d8644ec06ec6cef986a3f5be375be
|
3 |
+
size 1937823489
|
pytorch_model-00005-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3b295c170c33adf209f507609fbec201a3534edd0ca2530d6524cc3dc63b989
|
3 |
+
size 1963014163
|
pytorch_model-00006-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eb3d4c2c9b32ac6e07eb649294497621e5511c244ba780b8476e3fa22b71ea6a
|
3 |
+
size 1937823489
|
pytorch_model-00007-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:02c8539dc2ee3003f392001d61cd67a924fd6a4abdb6fddd70b366b703a8141c
|
3 |
+
size 1963014227
|
pytorch_model-00008-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b7fe91599763599e612ff79bca50d1be9dd7cb9030d1e6dbacdb51dc45e22afa
|
3 |
+
size 1937823489
|
pytorch_model-00009-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:df8dae357eb00345ef42506045de1723869dabe8cf89fa192e06137cf3cd395d
|
3 |
+
size 1963014227
|
pytorch_model-00010-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d8add13dc25f54db6df0a8b5e8135a63f670ac7bcbcb5706b541daa96bdfdd6c
|
3 |
+
size 1937823489
|
pytorch_model-00011-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:32af852ccb9936da7d332e22beda929de7fcb1f96c39262b836bca387fe0161d
|
3 |
+
size 1963014227
|
pytorch_model-00012-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ff97793ae1fe4d27af4f9209fbf2e532cd4fb1ccc39e399aa2f58bddb765f186
|
3 |
+
size 1937823489
|
pytorch_model-00013-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d0c08ce8a307fa5fa3caebff931e1bf540e861e2fa38b1bfa4bcf91f7277e10
|
3 |
+
size 1963014227
|
pytorch_model-00014-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:15ebf9dcba9bd6b42c165736792b2ebdc33840bffc65c4314a0c704e34917d9e
|
3 |
+
size 1937823489
|
pytorch_model-00015-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e353fef3f3a242e8e5af05afca8e5113582d7ea3225fbe1ce111e32816e48a2c
|
3 |
+
size 1963014227
|
pytorch_model-00016-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ade1ad7844c0523e10e50cf541e20becd8d0a011305a0b5d49becc94cdf6692a
|
3 |
+
size 1937823489
|
pytorch_model-00017-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d969e5162667a98b6ed514bbf8a92f611994673ff47155a526b0092863ebc6e9
|
3 |
+
size 1963014227
|
pytorch_model-00018-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1a8721d0d742ce15ae0f3081249b7cd7bb907701ee543101979d297cd9d6120f
|
3 |
+
size 1937823489
|
pytorch_model-00019-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:15b81635b5847683c9c943f8d819c29934a01e5a9e00a99464d8c5c3564d2938
|
3 |
+
size 1963014227
|
pytorch_model-00020-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4d0dc96e4be3de25d042446799c96aa3bfb5204132cfe1d48db6f456aaf79bb1
|
3 |
+
size 1560347805
|
pytorch_model-00021-of-00021.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1783c28825d2881dd23254e19422472464fdcd28416c9d9ae79b4fb46911ca1b
|
3 |
+
size 1137181610
|
pytorch_model.bin.index.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e110c305db80b79307dbccd08c7e923304c1deff95dc6460ea62b7fa74716f46
|
3 |
+
size 27171
|
tokenizer_config.json
CHANGED
@@ -1,30 +1,4 @@
|
|
1 |
{
|
2 |
-
"added_tokens_decoder": {
|
3 |
-
"0": {
|
4 |
-
"content": "<unk>",
|
5 |
-
"lstrip": false,
|
6 |
-
"normalized": false,
|
7 |
-
"rstrip": false,
|
8 |
-
"single_word": false,
|
9 |
-
"special": true
|
10 |
-
},
|
11 |
-
"1": {
|
12 |
-
"content": "<s>",
|
13 |
-
"lstrip": false,
|
14 |
-
"normalized": false,
|
15 |
-
"rstrip": false,
|
16 |
-
"single_word": false,
|
17 |
-
"special": true
|
18 |
-
},
|
19 |
-
"2": {
|
20 |
-
"content": "</s>",
|
21 |
-
"lstrip": false,
|
22 |
-
"normalized": false,
|
23 |
-
"rstrip": false,
|
24 |
-
"single_word": false,
|
25 |
-
"special": true
|
26 |
-
}
|
27 |
-
},
|
28 |
"auto_map": {
|
29 |
"AutoTokenizer": [
|
30 |
"tokenization_internlm.InternLMTokenizer",
|
|
|
1 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
"auto_map": {
|
3 |
"AutoTokenizer": [
|
4 |
"tokenization_internlm.InternLMTokenizer",
|