@@ -11,6 +11,10 @@ mkdir -p "$2"
11
11
OUT=$( realpath " $1 " )
12
12
MNT=$( realpath " $2 " )
13
13
14
+ rm -v $OUT /* .log
15
+ rm -v $OUT /* .exit
16
+ rm -v $OUT /* .md
17
+
14
18
sd=` dirname $0 `
15
19
cd $sd /../
16
20
SRC=` pwd`
@@ -128,15 +132,20 @@ function gg_run_open_llama_3b_v2 {
128
132
gg_wget models-mnt/open-llama/3B-v2/ https://huggingface.co/openlm-research/open_llama_3b_v2/resolve/main/pytorch_model.bin
129
133
gg_wget models-mnt/open-llama/3B-v2/ https://huggingface.co/openlm-research/open_llama_3b_v2/raw/main/generation_config.json
130
134
135
+ gg_wget models-mnt/wikitext/ https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-2-raw-v1.zip
136
+ unzip -o models-mnt/wikitext/wikitext-2-raw-v1.zip -d models-mnt/wikitext/
137
+ head -n 60 models-mnt/wikitext/wikitext-2-raw/wiki.test.raw > models-mnt/wikitext/wikitext-2-raw/wiki.test-60.raw
138
+
139
+ path_models=" ../models-mnt/open-llama/3B-v2"
140
+ path_wiki=" ../models-mnt/wikitext/wikitext-2-raw"
141
+
131
142
rm -rf build-ci-release && mkdir build-ci-release && cd build-ci-release
132
143
133
144
set -e
134
145
135
146
(time cmake -DCMAKE_BUILD_TYPE=Release -DLLAMA_QKK_64=1 .. ) 2>&1 | tee -a $OUT /${ci} -cmake.log
136
147
(time make -j ) 2>&1 | tee -a $OUT /${ci} -make.log
137
148
138
- path_models=" ../models-mnt/open-llama/3B-v2"
139
-
140
149
python3 ../convert.py ${path_models}
141
150
142
151
model_f16=" ${path_models} /ggml-model-f16.bin"
@@ -150,6 +159,8 @@ function gg_run_open_llama_3b_v2 {
150
159
model_q5_k=" ${path_models} /ggml-model-q5_k.bin"
151
160
model_q6_k=" ${path_models} /ggml-model-q6_k.bin"
152
161
162
+ wiki_test_60=" ${path_wiki} /wiki.test-60.raw"
163
+
153
164
./bin/quantize ${model_f16} ${model_q8_0} q8_0
154
165
./bin/quantize ${model_f16} ${model_q4_0} q4_0
155
166
./bin/quantize ${model_f16} ${model_q4_1} q4_1
@@ -160,25 +171,62 @@ function gg_run_open_llama_3b_v2 {
160
171
./bin/quantize ${model_f16} ${model_q5_k} q5_k
161
172
./bin/quantize ${model_f16} ${model_q6_k} q6_k
162
173
163
- (time ./bin/main --model ${model_f16} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-f16.log
164
- (time ./bin/main --model ${model_q8_0} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q8_0.log
165
- (time ./bin/main --model ${model_q4_0} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q4_0.log
166
- (time ./bin/main --model ${model_q4_1} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q4_1.log
167
- (time ./bin/main --model ${model_q5_0} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q5_0.log
168
- (time ./bin/main --model ${model_q5_1} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q5_1.log
169
- (time ./bin/main --model ${model_q3_k} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q3_k.log
170
- (time ./bin/main --model ${model_q4_k} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q4_k.log
171
- (time ./bin/main --model ${model_q5_k} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q5_k.log
172
- (time ./bin/main --model ${model_q6_k} -s 1234 -n 64 -t 8 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q6_k.log
174
+ (time ./bin/main --model ${model_f16} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-f16.log
175
+ (time ./bin/main --model ${model_q8_0} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q8_0.log
176
+ (time ./bin/main --model ${model_q4_0} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q4_0.log
177
+ (time ./bin/main --model ${model_q4_1} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q4_1.log
178
+ (time ./bin/main --model ${model_q5_0} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q5_0.log
179
+ (time ./bin/main --model ${model_q5_1} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q5_1.log
180
+ (time ./bin/main --model ${model_q3_k} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q3_k.log
181
+ (time ./bin/main --model ${model_q4_k} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q4_k.log
182
+ (time ./bin/main --model ${model_q5_k} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q5_k.log
183
+ (time ./bin/main --model ${model_q6_k} -s 1234 -n 64 -p " I believe the meaning of life is" ) 2>&1 | tee -a $OUT /${ci} -tg-q6_k.log
184
+
185
+ (time ./bin/perplexity --model ${model_f16} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-f16.log
186
+ (time ./bin/perplexity --model ${model_q8_0} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q8_0.log
187
+ (time ./bin/perplexity --model ${model_q4_0} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q4_0.log
188
+ (time ./bin/perplexity --model ${model_q4_1} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q4_1.log
189
+ (time ./bin/perplexity --model ${model_q5_0} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q5_0.log
190
+ (time ./bin/perplexity --model ${model_q5_1} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q5_1.log
191
+ (time ./bin/perplexity --model ${model_q3_k} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q3_k.log
192
+ (time ./bin/perplexity --model ${model_q4_k} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q4_k.log
193
+ (time ./bin/perplexity --model ${model_q5_k} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q5_k.log
194
+ (time ./bin/perplexity --model ${model_q6_k} -f ${wiki_test_60} -c 2048 ) 2>&1 | tee -a $OUT /${ci} -tg-q6_k.log
195
+
196
+ function check_ppl {
197
+ qnt=" $1 "
198
+ ppl=$( echo " $2 " | grep -oE " [0-9]+\.[0-9]+" | tail -n 1)
199
+
200
+ if [ $( echo " $ppl > 100.0" | bc) -eq 1 ]; then
201
+ printf ' - %s @ %s (FAIL: ppl > 100.0)\n' " $qnt " " $ppl "
202
+ return 100
203
+ fi
204
+
205
+ printf ' - %s @ %s OK\n' " $qnt " " $ppl "
206
+ return 0
207
+ }
208
+
209
+ check_ppl " f16" " $( cat $OUT /${ci} -tg-f16.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
210
+ check_ppl " q8_0" " $( cat $OUT /${ci} -tg-q8_0.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
211
+ check_ppl " q4_0" " $( cat $OUT /${ci} -tg-q4_0.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
212
+ check_ppl " q4_1" " $( cat $OUT /${ci} -tg-q4_1.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
213
+ check_ppl " q5_0" " $( cat $OUT /${ci} -tg-q5_0.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
214
+ check_ppl " q5_1" " $( cat $OUT /${ci} -tg-q5_1.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
215
+ check_ppl " q3_k" " $( cat $OUT /${ci} -tg-q3_k.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
216
+ check_ppl " q4_k" " $( cat $OUT /${ci} -tg-q4_k.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
217
+ check_ppl " q5_k" " $( cat $OUT /${ci} -tg-q5_k.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
218
+ check_ppl " q6_k" " $( cat $OUT /${ci} -tg-q6_k.log | grep " ^\[1\]" ) " | tee -a $OUT /${ci} -ppl.log
219
+
173
220
174
221
set +e
175
222
}
176
223
177
224
function gg_sum_open_llama_3b_v2 {
178
225
gg_printf ' ### %s\n\n' " ${ci} "
179
226
180
- gg_printf ' OpenLLaMA 3B-v2: text generation \n'
227
+ gg_printf ' OpenLLaMA 3B-v2:\n'
181
228
gg_printf ' - status: %s\n' " $( cat $OUT /${ci} .exit) "
229
+ gg_printf ' - perplexity:\n%s\n' " $( cat $OUT /${ci} -ppl.log) "
182
230
gg_printf ' - f16: \n```\n%s\n```\n' " $( cat $OUT /${ci} -tg-f16.log) "
183
231
gg_printf ' - q8_0:\n```\n%s\n```\n' " $( cat $OUT /${ci} -tg-q8_0.log) "
184
232
gg_printf ' - q4_0:\n```\n%s\n```\n' " $( cat $OUT /${ci} -tg-q4_0.log) "
0 commit comments