Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit cfc40ab

Browse files
authored
add int3 test (#275)
Signed-off-by: intellinjun <[email protected]>
1 parent e0e65bd commit cfc40ab

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.github/workflows/scripts/models/cpp_graph_inference.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function main() {
2626
quant_script="./build/bin/quant_llama"
2727
infer_cmd="./build/bin/run_llama"
2828
input_model="/tf_dataset2/models/pytorch/Meta-Llama-3-8B"
29-
precision_list=("q4_j_b128" "q4_j_b32" "q4_0")
29+
precision_list=("q4_j_b128" "q4_j_b32" "q4_0" "q5_j_i8_pc_asym" "q3_j_i8_b128_asym")
3030
elif [[ "${model}" == "gpt-neox-20b" ]]; then
3131
convert_script="${scripts_dir}/convert_gptneox.py"
3232
quant_script="./build/bin/quant_gptneox"
@@ -129,6 +129,10 @@ function main() {
129129
${quant_script} --model_file ${working_dir}/${model}-fp32.bin --out_file ${working_dir}/${model}-${precision}.bin --nthread $cores_per_instance --weight_dtype int4 --group_size 32 --scale_dtype fp32 --compute_dtype fp32 --alg sym
130130
elif [[ ${precision} == "q4_j_b128" ]]; then
131131
${quant_script} --model_file ${working_dir}/${model}-fp32.bin --out_file ${working_dir}/${model}-${precision}.bin --nthread $cores_per_instance --weight_dtype int4 --group_size 128 --scale_dtype fp32 --compute_dtype fp32 --alg sym
132+
elif [[ ${precision} == "q3_j_i8_b128_asym" ]]; then
133+
${quant_script} --model_file ${working_dir}/${model}-fp32.bin --out_file ${working_dir}/${model}-${precision}.bin --nthread $cores_per_instance --weight_dtype int3 --group_size 128 --scale_dtype fp32 --compute_dtype int8 --alg asym
134+
elif [[ ${precision} == "q5_j_i8_pc_asym" ]]; then
135+
${quant_script} --model_file ${working_dir}/${model}-fp32.bin --out_file ${working_dir}/${model}-${precision}.bin --nthread $cores_per_instance --weight_dtype int5 --group_size -1 --scale_dtype fp32 --compute_dtype int8 --alg asym
132136
elif [[ ${precision} == "q4_j_b128_asym" ]]; then
133137
${quant_script} --model_file ${working_dir}/${model}-fp32.bin --out_file ${working_dir}/${model}-${precision}.bin --nthread $cores_per_instance --weight_dtype int4 --group_size 128 --scale_dtype fp32 --compute_dtype fp32 --alg asym
134138
elif [[ ${precision} == "q4_0" ]]; then

tests/model-test/cpp_graph_inference.sh

+18-1
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,16 @@ function main() {
206206
quant_script="./build/bin/quant_llama"
207207
convert_script="${convert_script}/convert_llama.py"
208208
infer_cmd="./build/bin/run_llama"
209+
precision_list+=("q5_j_i8_g128" "q3_j_i8_g128" "q5_j_i8_g128_asym" "q3_j_i8_g128_asym"
210+
"q3_j_i8_pc_asym" "q5_j_i8_pc_asym"
211+
)
209212
elif [[ "${model}" == "gptj-6b" ]]; then
210213
quant_script="./build/bin/quant_gptj"
211214
convert_script="${convert_script}/convert_gptj.py"
212215
infer_cmd="./build/bin/run_gptj"
213-
precision_list+=("q4_j1_i8_g128" "q4_j1_bf16_pc")
216+
precision_list+=("q4_j1_i8_g128" "q4_j1_bf16_pc" "q5_j_i8_g128" "q3_j_i8_g128" "q5_j_i8_g128_asym" "q3_j_i8_g128_asym"
217+
"q3_j_i8_pc_asym" "q5_j_i8_pc_asym"
218+
)
214219
elif [[ "${model}" == "gpt-neox-20b" ]]; then
215220
quant_script="./build/bin/quant_gptneox"
216221
convert_script="${convert_script}/convert_gptneox.py"
@@ -421,6 +426,18 @@ function main() {
421426
eval "$quant_script_prologue --weight_dtype int4 --group_size 32 --compute_dtype int8 --scale_dtype fp32 --alg sym"
422427
elif [[ ${precision} == "q4_j_f32_g128" ]]; then
423428
eval "$quant_script_prologue --weight_dtype int4 --group_size 128 --compute_dtype fp32 --scale_dtype fp32 --alg sym"
429+
elif [[ ${precision} == "q3_j_i8_g128" ]]; then
430+
eval "$quant_script_prologue --weight_dtype int3 --group_size 128 --compute_dtype int8 --scale_dtype fp32 --alg sym"
431+
elif [[ ${precision} == "q5_j_i8_g128" ]]; then
432+
eval "$quant_script_prologue --weight_dtype int5 --group_size 128 --compute_dtype int8 --scale_dtype fp32 --alg sym"
433+
elif [[ ${precision} == "q3_j_i8_g128_asym" ]]; then
434+
eval "$quant_script_prologue --weight_dtype int3 --group_size 128 --compute_dtype int8 --scale_dtype fp32 --alg asym"
435+
elif [[ ${precision} == "q5_j_i8_g128_asym" ]]; then
436+
eval "$quant_script_prologue --weight_dtype int5 --group_size 128 --compute_dtype int8 --scale_dtype fp32 --alg asym"
437+
elif [[ ${precision} == "q3_j_i8_pc_asym" ]]; then
438+
eval "$quant_script_prologue --weight_dtype int3 --group_size -1 --compute_dtype int8 --scale_dtype fp32 --alg asym"
439+
elif [[ ${precision} == "q5_j_i8_pc_asym" ]]; then
440+
eval "$quant_script_prologue --weight_dtype int5 --group_size -1 --compute_dtype int8 --scale_dtype fp32 --alg asym"
424441
elif [[ ${precision} == "q4_j1_i8_g128" ]]; then
425442
eval "$quant_script_prologue --weight_dtype int4 --group_size 128 --compute_dtype int8 --scale_dtype fp32 --alg asym"
426443
elif [[ ${precision} == "q4_j1_bf16_pc" ]]; then

0 commit comments

Comments
 (0)