Skip to content

Commit f580332

Browse files
author
tianxin
authored
Tiny Fix (#1470)
1 parent 4d06421 commit f580332

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

examples/few_shot/efl/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ python -u -m paddle.distributed.launch --gpus "0" predict.py \
6565
--max_seq_length 512
6666
```
6767
68-
#### 基于静态图的预测部署
68+
#### 基于静态图的预测
6969
70-
使用动态图训练结束之后,可以将动态图参数导出成静态图参数,从而获得最优的预测部署性能,执行如下命令完成动态图转换静态图的功能:
70+
使用动态图训练结束之后,可以将动态图参数导出成静态图参数,从而获得最优的预测性能,执行如下命令完成动态图转换静态图的功能:
7171
```
7272
python export_model.py --params_path=./checkpoint/model_100/model_state.pdparams --output_path=./output
7373

7474
```
7575
76-
导出静态图模型之后,可以用于部署,`deploy/python/predict.py` 脚本提供了 python 部署预测示例。运行方式
76+
导出静态图模型之后,可以基于静态图做预测部署,`deploy/python/predict.py` 脚本提供了 python 静态图预测示例。以 tnews 数据集为例, 执行如下命令基于静态图预测
7777
```
78-
python deploy/python/predict.py --model_dir=./output
78+
python deploy/python/predict.py --model_dir=./output --task_name="tnews"
7979

8080
```
8181

examples/few_shot/efl/deploy/python/predict.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,10 @@ def predict(self, data, tokenizer):
196196

197197
# ErnieTinyTokenizer is special for ernie-tiny pretained model.
198198
tokenizer = ppnlp.transformers.ErnieTokenizer.from_pretrained('ernie-1.0')
199-
test_ds = load_dataset("fewclue", name="tnews", splits=["test"])
200-
processor = processor_dict["tnews"](9)
201-
test_ds = processor.get_test_datasets(test_ds, TASK_LABELS_DESC["tnews"])
199+
test_ds = load_dataset("fewclue", name=args.task_name, splits=["test"])
200+
processor = processor_dict[args.task_name]()
201+
test_ds = processor.get_test_datasets(test_ds,
202+
TASK_LABELS_DESC[args.task_name])
202203

203204
batches = [
204205
test_ds[idx:idx + args.batch_size]

0 commit comments

Comments
 (0)