Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Support phi series SQ (#1639)
Browse files Browse the repository at this point in the history
Signed-off-by: changwangss <[email protected]>
  • Loading branch information
changwangss authored Jun 28, 2024
1 parent b1168c1 commit c47dcb8
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 7 deletions.
52 changes: 52 additions & 0 deletions examples/.config/pytorch_optimize.json
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,58 @@
}
}
},
"phi_2b_gen_ipex_static": {
"working_dir": "huggingface/pytorch/text-generation/quantization",
"tune": {
"cmd": "bash run_tuning.sh",
"params": {
"topology": "phi_2b",
"task": "generation",
"approach": "static",
"output_model": "saved_results"
}
},
"benchmark": {
"cmd": "bash run_benchmark.sh",
"params": {
"topology": "phi_2b",
"task": "generation",
"approach": "static",
"backend": "ipex",
"mode": "benchmark",
"batch_size": "112",
"iters": "100",
"int8": "false",
"config": "saved_results"
}
}
},
"phi_3b_gen_ipex_static": {
"working_dir": "huggingface/pytorch/text-generation/quantization",
"tune": {
"cmd": "bash run_tuning.sh",
"params": {
"topology": "phi_3b",
"task": "generation",
"approach": "static",
"output_model": "saved_results"
}
},
"benchmark": {
"cmd": "bash run_benchmark.sh",
"params": {
"topology": "phi_3b",
"task": "generation",
"approach": "static",
"backend": "ipex",
"mode": "benchmark",
"batch_size": "112",
"iters": "100",
"int8": "false",
"config": "saved_results"
}
}
},
"flan-t5-large_gen_ipex_static": {
"working_dir": "huggingface/pytorch/text2text-generation",
"tune": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,18 @@ function run_benchmark {
model_name_or_path="Intel/neural-chat-7b-v3"
script="run_generation_sq.py"
elif [ "${topology}" = "phi_1b" ]; then
model_name_or_path="susnato/phi-1_dev"
pip install transformers==4.36.1
model_name_or_path="microsoft/phi-1"
script="run_generation_sq.py"
elif [ "${topology}" = "phi_1_5b" ]; then
model_name_or_path="susnato/phi-1_5_dev"
pip install transformers==4.36.1
model_name_or_path="microsoft/phi-1_5"
script="run_generation_sq.py"
elif [ "${topology}" = "phi_2b" ]; then
model_name_or_path="microsoft/phi-2"
script="run_generation_sq.py"
elif [ "${topology}" = "phi_3b" ]; then
model_name_or_path="microsoft/Phi-3-mini-4k-instruct"
script="run_generation_sq.py"
extra_cmd=$extra_cmd" --trust_remote_code"
elif [ "${topology}" = "llama2_7b_gptq" ] && [ "$model_source" != "huggingface" ]; then
model_name_or_path="/tf_dataset2/models/nlp_toolkit/llama-2-7b-chat/Llama-2-7b-chat-hf"
script="run_generation_cpu_woq.py"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,25 @@ function run_tuning {
script="run_generation_sq.py"
elif [ "${topology}" = "phi_1b" ]; then
alpha=0.5
model_name_or_path="susnato/phi-1_dev"
model_name_or_path="microsoft/phi-1"
extra_cmd=$extra_cmd" --sq --alpha ${alpha}"
extra_cmd=$extra_cmd" --output_dir ${tuned_checkpoint}"
extra_cmd=$extra_cmd" --trust_remote_code"
script="run_generation_sq.py"
elif [ "${topology}" = "phi_1_5b" ]; then
alpha=0.5
model_name_or_path="susnato/phi-1_5_dev"
model_name_or_path="microsoft/phi-1_5"
extra_cmd=$extra_cmd" --sq --alpha ${alpha}"
extra_cmd=$extra_cmd" --output_dir ${tuned_checkpoint}"
script="run_generation_sq.py"
elif [ "${topology}" = "phi_2b" ]; then
alpha=0.5
model_name_or_path="microsoft/phi-2"
extra_cmd=$extra_cmd" --sq --alpha ${alpha}"
extra_cmd=$extra_cmd" --output_dir ${tuned_checkpoint}"
script="run_generation_sq.py"
elif [ "${topology}" = "phi_3b" ]; then
alpha=0.5
model_name_or_path="microsoft/Phi-3-mini-4k-instruct"
extra_cmd=$extra_cmd" --sq --alpha ${alpha}"
extra_cmd=$extra_cmd" --output_dir ${tuned_checkpoint}"
extra_cmd=$extra_cmd" --trust_remote_code"
Expand Down

0 comments on commit c47dcb8

Please sign in to comment.