Skip to content

Commit 6c0bfac

Browse files
authored
【PaddleNLP No.22】Fix PIR for ernie-layout (#10484)
1 parent 276cfc2 commit 6c0bfac

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

slm/model_zoo/ernie-layout/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ python export_model.py --task_type cls --model_path ./ernie-layoutx-base-uncased
408408
export/
409409
├── inference.pdiparams
410410
├── inference.pdiparams.info
411-
└── inference.pdmodel
411+
└── inference.json(or inference.pdmodel if PIR is not enabled)
412412
```
413413

414414
<a name="52"></a>

slm/model_zoo/ernie-layout/README_ch.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ python export_model.py --task_type cls --model_path ./ernie-layoutx-base-uncased
410410
export/
411411
├── inference.pdiparams
412412
├── inference.pdiparams.info
413-
└── inference.pdmodel
413+
└── inference.json (在未开启PIR时为inference.pdmodel)
414414
```
415415

416416
<a name="52"></a>

slm/model_zoo/ernie-layout/deploy/python/predictor.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
from seqeval.metrics.sequence_labeling import get_entities
2626

2727
from paddlenlp.transformers import AutoTokenizer
28+
from paddlenlp.utils.env import (
29+
PADDLE_INFERENCE_MODEL_SUFFIX,
30+
PADDLE_INFERENCE_WEIGHTS_SUFFIX,
31+
)
2832
from paddlenlp.utils.image_utils import ppocr2example
2933
from paddlenlp.utils.log import logger
3034

@@ -33,8 +37,8 @@ class InferBackend(object):
3337
def __init__(self, model_path_prefix, device="cpu"):
3438
logger.info(">>> [InferBackend] Creating Engine ...")
3539
config = paddle.inference.Config(
36-
model_path_prefix + ".pdmodel",
37-
model_path_prefix + ".pdiparams",
40+
model_path_prefix + f"{PADDLE_INFERENCE_MODEL_SUFFIX}",
41+
model_path_prefix + f"{PADDLE_INFERENCE_WEIGHTS_SUFFIX}",
3842
)
3943
if device == "gpu":
4044
config.enable_use_gpu(100, 0)

0 commit comments

Comments
 (0)