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

Commit c47dcb8

Browse files
authored
Support phi series SQ (#1639)
Signed-off-by: changwangss <chang1.wang@intel.com>
1 parent b1168c1 commit c47dcb8

File tree

3 files changed

+75
-7
lines changed

3 files changed

+75
-7
lines changed

examples/.config/pytorch_optimize.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,58 @@
24502450
}
24512451
}
24522452
},
2453+
"phi_2b_gen_ipex_static": {
2454+
"working_dir": "huggingface/pytorch/text-generation/quantization",
2455+
"tune": {
2456+
"cmd": "bash run_tuning.sh",
2457+
"params": {
2458+
"topology": "phi_2b",
2459+
"task": "generation",
2460+
"approach": "static",
2461+
"output_model": "saved_results"
2462+
}
2463+
},
2464+
"benchmark": {
2465+
"cmd": "bash run_benchmark.sh",
2466+
"params": {
2467+
"topology": "phi_2b",
2468+
"task": "generation",
2469+
"approach": "static",
2470+
"backend": "ipex",
2471+
"mode": "benchmark",
2472+
"batch_size": "112",
2473+
"iters": "100",
2474+
"int8": "false",
2475+
"config": "saved_results"
2476+
}
2477+
}
2478+
},
2479+
"phi_3b_gen_ipex_static": {
2480+
"working_dir": "huggingface/pytorch/text-generation/quantization",
2481+
"tune": {
2482+
"cmd": "bash run_tuning.sh",
2483+
"params": {
2484+
"topology": "phi_3b",
2485+
"task": "generation",
2486+
"approach": "static",
2487+
"output_model": "saved_results"
2488+
}
2489+
},
2490+
"benchmark": {
2491+
"cmd": "bash run_benchmark.sh",
2492+
"params": {
2493+
"topology": "phi_3b",
2494+
"task": "generation",
2495+
"approach": "static",
2496+
"backend": "ipex",
2497+
"mode": "benchmark",
2498+
"batch_size": "112",
2499+
"iters": "100",
2500+
"int8": "false",
2501+
"config": "saved_results"
2502+
}
2503+
}
2504+
},
24532505
"flan-t5-large_gen_ipex_static": {
24542506
"working_dir": "huggingface/pytorch/text2text-generation",
24552507
"tune": {

examples/huggingface/pytorch/text-generation/quantization/run_benchmark.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,18 @@ function run_benchmark {
166166
model_name_or_path="Intel/neural-chat-7b-v3"
167167
script="run_generation_sq.py"
168168
elif [ "${topology}" = "phi_1b" ]; then
169-
model_name_or_path="susnato/phi-1_dev"
170-
pip install transformers==4.36.1
169+
model_name_or_path="microsoft/phi-1"
171170
script="run_generation_sq.py"
172171
elif [ "${topology}" = "phi_1_5b" ]; then
173-
model_name_or_path="susnato/phi-1_5_dev"
174-
pip install transformers==4.36.1
172+
model_name_or_path="microsoft/phi-1_5"
175173
script="run_generation_sq.py"
174+
elif [ "${topology}" = "phi_2b" ]; then
175+
model_name_or_path="microsoft/phi-2"
176+
script="run_generation_sq.py"
177+
elif [ "${topology}" = "phi_3b" ]; then
178+
model_name_or_path="microsoft/Phi-3-mini-4k-instruct"
179+
script="run_generation_sq.py"
180+
extra_cmd=$extra_cmd" --trust_remote_code"
176181
elif [ "${topology}" = "llama2_7b_gptq" ] && [ "$model_source" != "huggingface" ]; then
177182
model_name_or_path="/tf_dataset2/models/nlp_toolkit/llama-2-7b-chat/Llama-2-7b-chat-hf"
178183
script="run_generation_cpu_woq.py"

examples/huggingface/pytorch/text-generation/quantization/run_tuning.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,25 @@ function run_tuning {
216216
script="run_generation_sq.py"
217217
elif [ "${topology}" = "phi_1b" ]; then
218218
alpha=0.5
219-
model_name_or_path="susnato/phi-1_dev"
219+
model_name_or_path="microsoft/phi-1"
220220
extra_cmd=$extra_cmd" --sq --alpha ${alpha}"
221221
extra_cmd=$extra_cmd" --output_dir ${tuned_checkpoint}"
222-
extra_cmd=$extra_cmd" --trust_remote_code"
223222
script="run_generation_sq.py"
224223
elif [ "${topology}" = "phi_1_5b" ]; then
225224
alpha=0.5
226-
model_name_or_path="susnato/phi-1_5_dev"
225+
model_name_or_path="microsoft/phi-1_5"
226+
extra_cmd=$extra_cmd" --sq --alpha ${alpha}"
227+
extra_cmd=$extra_cmd" --output_dir ${tuned_checkpoint}"
228+
script="run_generation_sq.py"
229+
elif [ "${topology}" = "phi_2b" ]; then
230+
alpha=0.5
231+
model_name_or_path="microsoft/phi-2"
232+
extra_cmd=$extra_cmd" --sq --alpha ${alpha}"
233+
extra_cmd=$extra_cmd" --output_dir ${tuned_checkpoint}"
234+
script="run_generation_sq.py"
235+
elif [ "${topology}" = "phi_3b" ]; then
236+
alpha=0.5
237+
model_name_or_path="microsoft/Phi-3-mini-4k-instruct"
227238
extra_cmd=$extra_cmd" --sq --alpha ${alpha}"
228239
extra_cmd=$extra_cmd" --output_dir ${tuned_checkpoint}"
229240
extra_cmd=$extra_cmd" --trust_remote_code"

0 commit comments

Comments
 (0)