Skip to content
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

paddleX生成部署dll,用c#调用dll报错 #1131

Open
ximitiejiang opened this issue Sep 13, 2021 · 8 comments
Open

paddleX生成部署dll,用c#调用dll报错 #1131

ximitiejiang opened this issue Sep 13, 2021 · 8 comments
Assignees

Comments

@ximitiejiang
Copy link

问题类型:模型部署
问题描述

========================
使用paddleX提供的deploy/cpp代码,根据官方说明修改cmakelist,修改model_infer.cpp,生成dll文件进行部署。
在c#项目加载dll后进行推理报错,跟踪dll的代码后:在如下部分报错0x00007FFDE64B742C (paddle_inference.dll)处(位于 cs_paddle_infer_dll.exe 中)引发的异常: 0xC0000005: 写入位置 0x000000000000000F 时发生访问冲突。

bool PaddleInferenceEngine::Init(const InferenceConfig& infer_config) {
  const PaddleEngineConfig& engine_config = *(infer_config.paddle_config);
  paddle_infer::Config config;
  if ("" == engine_config.key) {
    config.SetModel(engine_config.model_filename,
                  engine_config.params_filename);  // 在该句报错,无法SetModel
  }

请问下可能是什么问题,有什么可以做的?

@ximitiejiang
Copy link
Author

版本如下(这个版本配置在另一个检测项目上已验证ok)
paddle_inference2.1.1
cuda10.2
cudnn7.6
tensorRT7.0.0.11

@ximitiejiang
Copy link
Author

找到一个问题了:
paddle_inference.dll只有release版本,如果在debug模式下生成model_infer.dll,虽然生成能成功,但运行报错如上所示。
只有在release模式下才能跑。所以想问下,是不是有预编译好的paddle_inference debug版本提供下载(官方貌似只找到release版本)?

@heliqi
Copy link
Collaborator

heliqi commented Sep 14, 2021

我们目前没有debug版本,只支持release版本

@ximitiejiang
Copy link
Author

paddleX最新2.0版本带的c# GUI调用版本,上面介绍说:

用户选择Debug X64模式进行调式

实际上只能在release模式跑,debug模式同样模型初始化失败,也应该是卡在paddel inference.dll的类型没有debug版本上吧~

为什么官方不能提供debug版本呢

@heliqi
Copy link
Collaborator

heliqi commented Sep 14, 2021

刚看了下文档,意思是c#可以用debug进行调试,编译dll的时候只能用release进行编译。

受限于引擎和第三方库等各种兼容性原因,无法提供debug版本。

@ximitiejiang
Copy link
Author

我实际测试下来,逻辑是反的:编译model_infer.dll是可以用debug编译,C# demo GUI只能用release运行,用debug调试就会报错。

@GZxian
Copy link

GZxian commented Sep 14, 2021

我c#加载模型直接闪退。

@Code-WHappy
Copy link

我实际测试,debug可以跑,release不行。但是我这台机直接用debug文件夹下应用程序可以跑,另外一台机就跑不了,直接提示无法导入model_infer.dll

@FlyingQianMM FlyingQianMM mentioned this issue Sep 15, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants