-
Notifications
You must be signed in to change notification settings - Fork 2
/
calib_config.py
215 lines (209 loc) · 9.5 KB
/
calib_config.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
import os
PROJ_DIR = f"{os.path.dirname(__file__)}"
CALIB_DIR = f"{PROJ_DIR}/calib_cache"
DATASET_CACHE = {
"wikitext2-v1": "YOUR_PATH_TO/.cache/huggingface/datasets/wikitext/wikitext-2-raw-v1/1.0.0/a241db52902eaf2c6aa732210bead40c090019a499ceb13bcbfa3f8ab646a126",
"ptb": "YOUR_PATH_TO/.cache/huggingface/datasets/ptb_text_only/penn_treebank/1.1.0/8d1b97746fb9765d140e569ec5ddd35e20af4d37761f5e1bf357ea0b081f2c1f",
}
MODEL_NAME_TO_PATH = {
"llama-7b": "YOUR_PATH_TO/llama-7b",
"llama2-7b": "YOUR_PATH_TO/llama2-7b",
"llama2-7b-chat": "YOUR_PATH_TO/llama2-7b-chat",
"llama2-7b-80k": "YOUR_PATH_TO/llama2-7b-80k",
"llama2-7b-32k": "YOUR_PATH_TO/llama2-7b-32k",
"llama2-13b": "YOUR_PATH_TO/llama2-13b",
"llama2-13b-chat": "YOUR_PATH_TO/llama2-13b-chat",
"llama2-70b": "YOUR_PATH_TO/Llama-2-70b-hf",
"llama3-70b-instruct": "YOUR_PATH_TO/Meta-Llama-3-70B-Instruct",
"mistral-7b": "YOUR_PATH_TO/.cache/huggingface/hub/models--mistralai--Mistral-7B-v0.1/snapshots/26bca36bde8333b5d7f72e9ed20ccda6a618af24",
"mistral-7b-instruct-v0.2": "YOUR_PATH_TO/mistral-7b-instruct-v0.2",
"vicuna-v1.5-7b-16k": "YOUR_PATH_TO/.cache/huggingface/hub/models--lmsys--vicuna-7b-v1.5-16k/snapshots/c8df3ca4436a3bce5c4b5877e0117032081852b4",
"longchat-v1.5-7b-32k": "YOUR_PATH_TO/.cache/huggingface/hub/models--lmsys--longchat-7b-v1.5-32k/snapshots/16deb633ef4d6a18d5750239edc5a85ffeaf3918",
}
MODEL_TO_SMOOTH = {
"llama-7b": f"{CALIB_DIR}/llama-7b-wikitext2-v1-n256-len2048-smooth-alpha1.0.pt",
"llama2-7b": f"{CALIB_DIR}/llama2-7b-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
"llama2-7b-chat": f"{CALIB_DIR}/llama2-7b-chat-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
"llama2-7b-80k": f"{CALIB_DIR}/llama2-7b-80k-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
# "llama2-7b-80k": f"{CALIB_DIR}/llama2-7b-80k-g128-smooth-learning-n4096.pt",
"llama2-7b-32k": f"{CALIB_DIR}/llama2-7b-32k-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
# "llama2-7b-80k": f"{CALIB_DIR}/llama2-7b-80k-wikitext2-v1-n128-len20000-smooth-alpha0.7-p0.90.pt",
# "llama2-7b-80k": f"{CALIB_DIR}/llama2-7b-80k-wikitext2-v1-n128-len20000-smooth-alpha1.0.pt",
"llama2-13b": f"{CALIB_DIR}/llama2-13b-wikitext2-v1-n256-len4096-smooth-alpha0.7-p0.90.pt",
"llama2-13b-chat": f"{CALIB_DIR}/llama2-13b-chat-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
"llama2-70b": f"{CALIB_DIR}/llama2-70b-wikitext2-v1-n256-len4096-smooth-alpha0.7-p0.90.pt",
"llama3-70b-instruct": f"{CALIB_DIR}/llama3-70b-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
"mistral-7b": f"{CALIB_DIR}/mistral-7b-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
"mistral-7b-instruct-v0.2": f"{CALIB_DIR}/mistral-7b-instruct-v0.2-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
"vicuna-v1.5-7b-16k": f"{CALIB_DIR}/vicuna-v1.5-7b-16k-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
"longchat-v1.5-7b-32k": f"{CALIB_DIR}/longchat-v1.5-7b-32k-wikitext2-v1-n256-len4096-smooth-alpha1.0.pt",
}
MODEL_TO_REORDER = {
"llama-7b": {
128: {
"minmax": f"{CALIB_DIR}/llama-7b-wikitext2-v1-n256-len2048-minmax-rod_idx-cluster_32.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama-7b-wikitext2-v1-n256-len2048-minmax-rod_idx-cluster_64.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama-7b-wikitext2-v1-n256-len2048-minmax-rod_idx-cluster_128.pt",
},
16: {
"minmax": f"{CALIB_DIR}/llama-7b-wikitext2-v1-n256-len2048-minmax-rod_idx-cluster_256.pt",
},
},
"llama2-7b": {
128: {
"minmax": f"{CALIB_DIR}/llama2-7b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama2-7b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_64.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama-7b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_128.pt",
},
16: {
"minmax": f"{CALIB_DIR}/llama-7b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_256.pt",
},
},
"llama2-7b-chat": {
256: {
"minmax": f"{CALIB_DIR}/llama2-7b-chat-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_16.pt",
},
128: {
"minmax": f"{CALIB_DIR}/llama2-7b-chat-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama2-7b-chat-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_64.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama2-7b-chat-wikitext2-v1-n128-len4000-minmax-rod_idx-cluster_64.pt",
},
16: {
"minmax": f"{CALIB_DIR}/llama2-7b-chat-wikitext2-v1-n128-len4000-minmax-rod_idx-cluster_256.pt",
},
},
"llama2-13b-chat": {
128: {
"minmax": f"{CALIB_DIR}/llama2-13b-chat-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_40.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama2-13b-chat-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_80.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama2-13b-chat-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_160.pt",
},
},
"llama2-13b": {
128: {
"minmax": f"{CALIB_DIR}/llama2-13b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_40.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama2-13b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_80.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama2-13b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_160.pt",
},
},
"llama2-7b-80k": {
128: {
"minmax": f"{CALIB_DIR}/llama2-7b-80k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama2-7b-80k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_64.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama2-7b-80k-wikitext2-v1-n128-len20000-minmax-rod_idx-cluster_128.pt",
},
},
"llama2-7b-32k": {
128: {
"minmax": f"{CALIB_DIR}/llama2-7b-32k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama2-7b-32k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_64.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama2-7b-32k-wikitext2-v1-n128-len20000-minmax-rod_idx-cluster_128.pt",
},
},
"llama2-70b": {
128: {
"minmax": f"{CALIB_DIR}/llama2-70b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_8.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama2-70b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_16.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama2-70b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
},
"llama3-70b-instruct": {
128: {
"minmax": f"{CALIB_DIR}/llama3-70b-instruct-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_8.pt",
},
64: {
"minmax": f"{CALIB_DIR}/llama3-70b-instruct-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_16.pt",
},
32: {
"minmax": f"{CALIB_DIR}/llama3-70b-instruct-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
},
"mistral-7b": {
256: {
"minmax": f"{CALIB_DIR}/mistral-7b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_4.pt"
},
128: {
"minmax": f"{CALIB_DIR}/mistral-7b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_8.pt"
},
64: {
"minmax": f"{CALIB_DIR}/mistral-7b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_16.pt",
},
32: {
"minmax": f"{CALIB_DIR}/mistral-7b-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
},
"mistral-7b-instruct-v0.2": {
256: {
"minmax": f"{CALIB_DIR}/mistral-7b-instruct-v0.2-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_4.pt"
},
128: {
"minmax": f"{CALIB_DIR}/mistral-7b-instruct-v0.2-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_8.pt"
},
64: {
"minmax": f"{CALIB_DIR}/mistral-7b-instruct-v0.2-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_16.pt",
},
32: {
"minmax": f"{CALIB_DIR}/mistral-7b-instruct-v0.2-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
},
"vicuna-v1.5-7b-16k": {
256: {
"minmax": f"{CALIB_DIR}/vicuna-v1.5-7b-16k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_16.pt",
},
128: {
"minmax": f"{CALIB_DIR}/vicuna-v1.5-7b-16k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
64: {
"minmax": f"{CALIB_DIR}/vicuna-v1.5-7b-16k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_64.pt",
},
32: {
"minmax": f"{CALIB_DIR}/vicuna-v1.5-7b-16k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_128.pt",
},
},
"longchat-v1.5-7b-32k": {
256: {
"minmax": f"{CALIB_DIR}/longchat-v1.5-7b-32k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_16.pt",
},
128: {
"minmax": f"{CALIB_DIR}/longchat-v1.5-7b-32k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_32.pt",
},
64: {
"minmax": f"{CALIB_DIR}/longchat-v1.5-7b-32k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_64.pt",
},
32: {
"minmax": f"{CALIB_DIR}/longchat-v1.5-7b-32k-wikitext2-v1-n256-len4096-minmax-rod_idx-cluster_128.pt",
},
},
}