Skip to content

Commit e37c6da

Browse files
committed
Eval fix
1 parent 60b4de7 commit e37c6da

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

.ci/scripts/validate.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,23 @@ function eval_model() {
227227
echo "perplexity checking succeeded for non-quantized model $MODEL_NAME with $DTYPE $TARGET_DEVICE"
228228
fi;
229229

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 "******************************************"
233234

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
245247

246248
done
247249
}

0 commit comments

Comments
 (0)