@@ -227,21 +227,23 @@ function eval_model() {
227
227
echo " perplexity checking succeeded for non-quantized model $MODEL_NAME with $DTYPE $TARGET_DEVICE "
228
228
fi ;
229
229
230
- echo " ******************************************"
231
- echo " ******** INT4 group-wise quantized *******"
232
- echo " ******************************************"
230
+ if [[ " $TARGET_DEVICE " != " cuda" || " $DTYPE " == " bfloat16" ]]; then
231
+ echo " ******************************************"
232
+ echo " ******** INT4 group-wise quantized *******"
233
+ echo " ******************************************"
233
234
234
- export QUANT_OPTIONS=' {"linear:int4" : {"groupsize": 32}}'
235
- python -W ignore eval.py --compile --dtype ${DTYPE} --quant " $QUANT_OPTIONS " --checkpoint-path " $CHECKPOINT_PATH " --device " $TARGET_DEVICE " > " $MODEL_DIR /eval" || exit 1
236
- cat " $MODEL_DIR /eval"
237
- export REF_PERPLEXITY=100000
238
- export PERPLEXITY=cat " $MODEL_DIR /eval" | tail -n 1 log | awk -F ' [, ]' ' {print $4}'
239
- # == 1 meaning the check succeeded
240
- if [ " $( echo " $PERPLEXITY >= $REF_PERPLEXITY " | bc) " == 1]; then
241
- echo " perplexity checking failed for int4-quantized model $MODEL_NAME with $DTYPE $TARGET_DEVICE $QUANT_OPTIONS "
242
- else
243
- echo " perplexity checking succeeded for int4-quantized model $MODEL_NAME with $DTYPE $TARGET_DEVICE $QUANT_OPTIONS "
244
- fi ;
235
+ export QUANT_OPTIONS=' {"linear:int4" : {"groupsize": 32}}'
236
+ python -W ignore eval.py --compile --dtype ${DTYPE} --quant " $QUANT_OPTIONS " --checkpoint-path " $CHECKPOINT_PATH " --device " $TARGET_DEVICE " > " $MODEL_DIR /eval" || exit 1
237
+ cat " $MODEL_DIR /eval"
238
+ export REF_PERPLEXITY=100000
239
+ export PERPLEXITY=cat " $MODEL_DIR /eval" | tail -n 1 log | awk -F ' [, ]' ' {print $4}'
240
+ # == 1 meaning the check succeeded
241
+ if [ " $( echo " $PERPLEXITY >= $REF_PERPLEXITY " | bc) " == 1]; then
242
+ echo " perplexity checking failed for int4-quantized model $MODEL_NAME with $DTYPE $TARGET_DEVICE $QUANT_OPTIONS "
243
+ else
244
+ echo " perplexity checking succeeded for int4-quantized model $MODEL_NAME with $DTYPE $TARGET_DEVICE $QUANT_OPTIONS "
245
+ fi ;
246
+ fi
245
247
246
248
done
247
249
}
0 commit comments