Skip to content

[Bug]: export静态图无报错但没有pdmodel文件 #10415

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
1 task done
cycao77 opened this issue Apr 15, 2025 · 2 comments
Open
1 task done

[Bug]: export静态图无报错但没有pdmodel文件 #10415

cycao77 opened this issue Apr 15, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@cycao77
Copy link

cycao77 commented Apr 15, 2025

软件环境

paddle2onnx                              2.0.0
paddlefsl                                1.1.0
paddlenlp                                3.0.0b2
paddlepaddle-gpu                         3.0.0rc1

重复问题

  • I have searched the existing issues

错误描述

使用PaddleNLP/slm/examples/machine_reading_comprehension
/SQuAD训完后export静态图,没有报错但目录中没有pdmodel文件,export日志:
[2025-04-15 20:30:54,323] [ WARNING] - Detected that datasets module was imported before paddlenlp. This may cause PaddleNLP datasets to be unavalible in intranet. Please import paddlenlp before datasets module to avoid download issues
[2025-04-15 20:30:55,490] [    INFO] - Loading configuration file ./trained_models/mrc_squad2_all45_v2/model_172000/config.json
[2025-04-15 20:30:55,491] [    INFO] - Loading weights file ./trained_models/mrc_squad2_all45_v2/model_172000/model_state.pdparams
[2025-04-15 20:30:56,101] [    INFO] - Loaded weights file from disk, setting weights to model.
W0415 20:30:56.327435 59824 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 8.0, Driver API Version: 12.4, Runtime API Version: 12.3
W0415 20:30:56.328116 59824 gpu_resources.cc:164] device: 0, cuDNN Version: 9.8.
[2025-04-15 20:30:56,989] [    INFO] - All model checkpoint weights were used when initializing ErnieForQuestionAnswering.

[2025-04-15 20:30:56,989] [    INFO] - All the weights of ErnieForQuestionAnswering were initialized from the model checkpoint at ./trained_models/mrc_squad2_all45_v2/model_172000.
If your task is similar to the task the model of the checkpoint was trained on, you can already use ErnieForQuestionAnswering for predictions without further training.
/ssd3/zhaol/anaconda3/envs/paddlenlp_env/lib/python3.10/site-packages/paddle/jit/dy2static/program_translator.py:780: UserWarning: full_graph=False don't support input_spec arguments. It will not produce any effect.
You can set full_graph=True, then you can assign input spec.

  warnings.warn(
/ssd3/zhaol/anaconda3/envs/paddlenlp_env/lib/python3.10/site-packages/paddlenlp/transformers/utils.py:204: UserWarning: The `forward` method of <class 'paddlenlp.transformers.ernie.modeling.ErnieModel'> is patched and the patch might be based on an old oversion which missing some arguments compared with the latest, such as ['output_hidden_states', 'output_attentions', 'return_dict']. We automatically add compatibility on the patch for these arguemnts, and maybe the patch should be updated.
  warnings.warn(
/ssd3/zhaol/anaconda3/envs/paddlenlp_env/lib/python3.10/site-packages/paddlenlp/transformers/utils.py:212: UserWarning: The `forward` method of <class 'paddle.nn.layer.transformer.TransformerEncoder'> is patched and the patch might be conflict with patches made by paddlenlp which seems have more arguments such as ['output_hidden_states', 'output_attentions', 'return_dict']. We automatically add compatibility on the patch for these arguemnts, and maybe the patch should be updated.
  warnings.warn(
[2025-04-15 20:30:58,691] [    INFO] - tokenizer config file saved in ./infer_model/tokenizer_config.json
[2025-04-15 20:30:58,691] [    INFO] - Special tokens file saved in ./infer_model/special_tokens_map.json

export之后的infer文件夹:
model.json  model.pdiparams  special_tokens_map.json  tokenizer_config.json  vocab.txt

运行python -u deploy/python/predict.py报错:
config = paddle.inference.Config(args.model_name_or_path + ".pdmodel", args.model_name_or_path + ".pdiparams")
RuntimeError: (NotFound) Cannot open file ./infer_model/model.pdmodel, please confirm whether the file is normal.
  [Hint: Expected paddle::inference::IsFileExists(prog_file_) == true, but received paddle::inference::IsFileExists(prog_file_):0 != true:1.] (at ../paddle/fluid/inference/api/analysis_config.cc:112)

稳定复现步骤 & 代码

我是按照https://github.com/PaddlePaddle/PaddleNLP/tree/develop/slm/examples/machine_reading_comprehension/SQuAD#%E9%9D%99%E6%80%81%E5%9B%BE%E9%A2%84%E6%B5%8B 的步骤进行的

@cycao77 cycao77 added the bug Something isn't working label Apr 15, 2025
@cycao77
Copy link
Author

cycao77 commented Apr 16, 2025

应该是新版本的bug,降低版本后可以export成功,降低后是:
paddlenlp 2.6.0
paddlepaddle-gpu 2.5.1.post102

paddle和paddlenlp版本兼容性太差了,用着真的让人不想用第二次,太烂了

@ZHUI
Copy link
Collaborator

ZHUI commented Apr 18, 2025

你好,最新的Paddle推理格式进行了升级。有一些没适配好的地方,目前我们正在修。不好意思 #9763

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants