Skip to content

【PaddleNLP No.23】 Fix pir in ernie-vil2.0 #10481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions slm/model_zoo/ernie-vil2.0/deploy/python/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
from PIL import Image

from paddlenlp.transformers import ErnieViLProcessor
from paddlenlp.utils.env import (
PADDLE_INFERENCE_MODEL_SUFFIX,
PADDLE_INFERENCE_WEIGHTS_SUFFIX,
)


def parse_arguments():
Expand Down Expand Up @@ -76,11 +80,11 @@ def __init__(self, args):
def create_fd_runtime(self, args):
option = fd.RuntimeOption()
if args.encode_type == "text":
model_path = os.path.join(args.model_dir, "get_text_features.pdmodel")
params_path = os.path.join(args.model_dir, "get_text_features.pdiparams")
model_path = os.path.join(args.model_dir, f"get_text_features{PADDLE_INFERENCE_MODEL_SUFFIX}")
params_path = os.path.join(args.model_dir, f"get_text_features{PADDLE_INFERENCE_WEIGHTS_SUFFIX}")
else:
model_path = os.path.join(args.model_dir, "get_image_features.pdmodel")
params_path = os.path.join(args.model_dir, "get_image_features.pdiparams")
model_path = os.path.join(args.model_dir, f"get_image_features{PADDLE_INFERENCE_MODEL_SUFFIX}")
params_path = os.path.join(args.model_dir, f"get_image_features{PADDLE_INFERENCE_WEIGHTS_SUFFIX}")
option.set_model_path(model_path, params_path)
if args.device == "kunlunxin":
option.use_kunlunxin()
Expand Down