Skip to content

Commit 4ede05a

Browse files
authored
fix crf inference bug and lac doc (#480)
1 parent 4167404 commit 4ede05a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

examples/lexical_analysis/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ python export_model.py --data_dir=./lexical_analysis_dataset_tiny --params_path=
106106
* `params_path`是指动态图训练保存的参数路径
107107
* `output_path`是指静态图参数导出路径。
108108

109-
导出模型之后,可以用于部署,deploy/python/predict.py文件提供了python部署预测示例。运行方式:
109+
导出模型之后,可以用于部署,deploy/predict.py文件提供了python部署预测示例。运行方式:
110110

111111
```shell
112-
python deploy/python/predict.py --model_file=infer_model/static_graph_params.pdmodel --params_file=infer_model/static_graph_params.pdiparams
112+
python deploy/predict.py --model_file=infer_model/static_graph_params.pdmodel --params_file=infer_model/static_graph_params.pdiparams --data_dir lexical_analysis_dataset_tiny
113113
```
114114

115115
### 模型预测

paddlenlp/layers/crf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def forward(self, inputs, lengths):
401401
alpha = logit
402402
left_length = left_length - ones
403403
continue
404-
alpha_exp = alpha.unsqueeze(2).expand_as(trans_exp)
404+
alpha_exp = alpha.unsqueeze(2)
405405
# alpha_trn_sum: batch_size, n_labels, n_labels
406406
alpha_trn_sum = alpha_exp + trans_exp
407407

0 commit comments

Comments
 (0)