File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
examples/model_compression/pp-minilm Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,9 @@ PP-MiniLM 压缩方案以面向预训练模型的任务无关知识蒸馏(Task-a
58
58
- batch sizes: 16, 32, 64;
59
59
- learning rates: 3e-5, 5e-5, 1e-4
60
60
61
- 2.量化后比量化前模型参数量多了 0.1M 是因为保存了 scale 值。
61
+ 2.量化后比量化前模型参数量多了 0.1M 是因为保存了 scale 值;
62
+
63
+ 3.性能测试的条件是:batch_size: 32, max_seq_len: 128。
62
64
63
65
** 方案流程**
64
66
@@ -197,7 +199,7 @@ export MODEL_PATH=ppminilm-6l-768h
197
199
export LR=1e-4
198
200
export BS=32
199
201
200
- python export_model.py --task_name ${TASK_NAME} --output_dir ${MODEL_PATH} /models/${TASK_NAME} /${LR} _${BS} /
202
+ python export_model.py --task_name ${TASK_NAME} --model_path ${MODEL_PATH} /models/${TASK_NAME} /${LR} _${BS} /
201
203
```
202
204
203
205
静态图(部署)模型路径与动态图模型的路径相同,文件名为 ` inference.pdmodel ` , ` inference.pdiparams ` 和 ` inference.pdiparams.info ` 。
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def parse_args():
34
34
help = "The name of the task to train selected in the list: " +
35
35
", " .join (METRIC_CLASSES .keys ()), )
36
36
parser .add_argument (
37
- "--output_dir " ,
37
+ "--model_path " ,
38
38
default = "best_clue_model" ,
39
39
type = str ,
40
40
help = "The output directory where the model predictions and checkpoints will be written." ,
@@ -50,9 +50,10 @@ def parse_args():
50
50
51
51
52
52
def do_export (args ):
53
- save_path = os .path .join (args .output_dir , "inference" )
54
- model = PPMiniLMForSequenceClassification .from_pretrained (args .output_dir )
53
+ save_path = os .path .join (os . path . dirname ( args .model_path ) , "inference" )
54
+ model = PPMiniLMForSequenceClassification .from_pretrained (args .model_path )
55
55
is_text_pair = True
56
+ args .task_name = args .task_name .lower ()
56
57
if args .task_name in ('tnews' , 'iflytek' , 'cluewsc2020' ):
57
58
is_text_pair = False
58
59
model .to_static (
You can’t perform that action at this time.
0 commit comments