Skip to content

Commit d75d5ad

Browse files
authored
[PIR] Fix ernie-vil2.0 (#10481)
1 parent 402e2e8 commit d75d5ad

File tree

1 file changed

+8
-4
lines changed
  • slm/model_zoo/ernie-vil2.0/deploy/python

1 file changed

+8
-4
lines changed

slm/model_zoo/ernie-vil2.0/deploy/python/infer.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
from PIL import Image
2121

2222
from paddlenlp.transformers import ErnieViLProcessor
23+
from paddlenlp.utils.env import (
24+
PADDLE_INFERENCE_MODEL_SUFFIX,
25+
PADDLE_INFERENCE_WEIGHTS_SUFFIX,
26+
)
2327

2428

2529
def parse_arguments():
@@ -76,11 +80,11 @@ def __init__(self, args):
7680
def create_fd_runtime(self, args):
7781
option = fd.RuntimeOption()
7882
if args.encode_type == "text":
79-
model_path = os.path.join(args.model_dir, "get_text_features.pdmodel")
80-
params_path = os.path.join(args.model_dir, "get_text_features.pdiparams")
83+
model_path = os.path.join(args.model_dir, f"get_text_features{PADDLE_INFERENCE_MODEL_SUFFIX}")
84+
params_path = os.path.join(args.model_dir, f"get_text_features{PADDLE_INFERENCE_WEIGHTS_SUFFIX}")
8185
else:
82-
model_path = os.path.join(args.model_dir, "get_image_features.pdmodel")
83-
params_path = os.path.join(args.model_dir, "get_image_features.pdiparams")
86+
model_path = os.path.join(args.model_dir, f"get_image_features{PADDLE_INFERENCE_MODEL_SUFFIX}")
87+
params_path = os.path.join(args.model_dir, f"get_image_features{PADDLE_INFERENCE_WEIGHTS_SUFFIX}")
8488
option.set_model_path(model_path, params_path)
8589
if args.device == "kunlunxin":
8690
option.use_kunlunxin()

0 commit comments

Comments
 (0)