Skip to content

兼容性调整:paddlepaddle-gpu==3.0.0rc1导出推理模型为.json格式,早期版本为.pdmodel,.pdipara… #14862

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 5 additions & 3 deletions tools/infer/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ def create_predictor(args, mode, logger):

else:
file_names = ["model", "inference"]
model_formats = ["pdmodel", "json"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以考虑优先去找.json格式模型,把json放前面?

for file_name in file_names:
model_file_path = "{}/{}.pdmodel".format(model_dir, file_name)
params_file_path = "{}/{}.pdiparams".format(model_dir, file_name)
if os.path.exists(model_file_path) and os.path.exists(params_file_path):
break
for model_format in model_formats:
model_file_path = "{}/{}.{}".format(model_dir, file_name, model_format)
if os.path.exists(model_file_path) and os.path.exists(params_file_path):
break
if not os.path.exists(model_file_path):
raise ValueError(
"not find model.pdmodel or inference.pdmodel in {}".format(model_dir)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面增加了找json格式模型的逻辑,这里的Error信息也得跟着变下

Expand Down