Giter Site home page Giter Site logo

Comments (16)

TinyQi avatar TinyQi commented on June 21, 2024

image

from paddlemix.

TinyQi avatar TinyQi commented on June 21, 2024

主要报错信息:InvalidArgumentError: Failed to parse program_desc from binary string.
[Hint: Expected desc_.ParseFromString(binary_str) == true, but received desc_.ParseFromString(binary_str):0 != true:1.] (at /paddle/paddle/fluid/framework/program_desc.cc:103)

from paddlemix.

LokeZhou avatar LokeZhou commented on June 21, 2024

提供一下最小复现代码

from paddlemix.

TinyQi avatar TinyQi commented on June 21, 2024

提供一下最小复现代码

就在这个引擎初始化的函数里面报错的:

`
bool PaddleInferenceEngine::Init(const InferenceConfig& infer_config)
{
const PaddleEngineConfig& engine_config = *(infer_config.paddle_config);
paddle_infer::Config config;

config.SetModel(engine_config.model_filename,
                engine_config.params_filename);

// 使用cpu推理时可以使用mkl进行加速
if (engine_config.use_mkl && !engine_config.use_gpu)
{
    config.EnableMKLDNN();

    config.SetMkldnnCacheCapacity(10);
}

config.SetCpuMathLibraryNumThreads(engine_config.mkl_thread_num);

if (engine_config.use_gpu)
{
    config.EnableUseGpu(100, engine_config.gpu_id);
}
else
{
    config.DisableGpu();
}
config.SwitchUseFeedFetchOps(false);
config.SwitchSpecifyInputNames(true);
config.SwitchIrOptim(engine_config.use_ir_optim);
config.EnableMemoryOptim();
config.DisableGlogInfo();
if (engine_config.use_trt && engine_config.use_gpu)
{
    paddle_infer::PrecisionType precision;
    if (engine_config.precision == 0)
    {
        precision = paddle_infer::PrecisionType::kFloat32;
    }
    else if (engine_config.precision == 1)
    {
        precision = paddle_infer::PrecisionType::kHalf;
    }
    else if (engine_config.precision == 2)
    {
        precision = paddle_infer::PrecisionType::kInt8;
    }
    else
    {
        std::cerr << "Can not support the set precision" << std::endl;
        return false;
    }
    config.EnableTensorRtEngine(
        engine_config.max_workspace_size, /* workspace_size*/
        engine_config.max_batch_size,     /* max_batch_size*/
        engine_config.min_subgraph_size,  /* min_subgraph_size*/
        precision,                        /* precision*/
        engine_config.use_static,         /* use_static*/
        engine_config.use_calib_mode);    /* use_calib_mode*/

    if (engine_config.min_input_shape.size() != 0) {
    config.SetTRTDynamicShapeInfo(engine_config.min_input_shape,
                                    engine_config.max_input_shape,
                                    engine_config.optim_input_shape);
    }
}

HLOG_INFO_Analyzer("begin to create paddle infference Predictor.");
predictor_ = std::move(paddle_infer::CreatePredictor(config));
HLOG_INFO_Analyzer("end of create paddle infference Predictor.");

return true;
}
`

from paddlemix.

zhoutianzi666 avatar zhoutianzi666 commented on June 21, 2024

使用CPU推理还是GPU推理报错的呢?

from paddlemix.

TinyQi avatar TinyQi commented on June 21, 2024

使用CPU推理还是GPU推理报错的呢?

你好,我CPU和GPU都试过,根本还没到推理,就初始化预测引擎的时候就报错了,报错就发生在我上面发的这个初始化函数里

from paddlemix.

zhoutianzi666 avatar zhoutianzi666 commented on June 21, 2024

使用CPU推理还是GPU推理报错的呢?

你好,我CPU和GPU都试过,根本还没到推理,就初始化预测引擎的时候就报错了,报错就发生在我上面发的这个初始化函数里
先加上这句话试试呢config.SwitchIrOptim(false);

from paddlemix.

TinyQi avatar TinyQi commented on June 21, 2024

使用CPU推理还是GPU推理报错的呢?

你好,我CPU和GPU都试过,根本还没到推理,就初始化预测引擎的时候就报错了,报错就发生在我上面发的这个初始化函数里
先加上这句话试试呢config.SwitchIrOptim(false);

刚刚试过了,不行,还是一样的错误。我导出的这个模型中,好像是需要重新编译C++扩展,会不会是模型中有一些模块无法被paddle_inference解析呢?

from paddlemix.

zhoutianzi666 avatar zhoutianzi666 commented on June 21, 2024

使用CPU推理还是GPU推理报错的呢?

你好,我CPU和GPU都试过,根本还没到推理,就初始化预测引擎的时候就报错了,报错就发生在我上面发的这个初始化函数里
先加上这句话试试呢config.SwitchIrOptim(false);

刚刚试过了,不行,还是一样的错误。我导出的这个模型中,好像是需要重新编译C++扩展,会不会是模型中有一些模块无法被paddle_inference解析呢?

试试python能推理吗?

from paddlemix.

TinyQi avatar TinyQi commented on June 21, 2024

使用CPU推理还是GPU推理报错的呢?

你好,我CPU和GPU都试过,根本还没到推理,就初始化预测引擎的时候就报错了,报错就发生在我上面发的这个初始化函数里
先加上这句话试试呢config.SwitchIrOptim(false);

刚刚试过了,不行,还是一样的错误。我导出的这个模型中,好像是需要重新编译C++扩展,会不会是模型中有一些模块无法被paddle_inference解析呢?

试试python能推理吗?

python是可以使用https://github.com/PaddlePaddle/PaddleMIX/blob/develop/deploy/groundingdino/predict.py这个脚本进行推理的,现在就是C++下不行

from paddlemix.

zhoutianzi666 avatar zhoutianzi666 commented on June 21, 2024

C++的话,应该要编译自定义算子呢

from paddlemix.

TinyQi avatar TinyQi commented on June 21, 2024

C++的话,应该要编译自定义算子呢

就是说要把新加的算子,编译到paddle_inference.so中,才能实现推理是不?如果是的话,请问有相关的指导文档嘛?

from paddlemix.

LokeZhou avatar LokeZhou commented on June 21, 2024

可以试试去掉deformable_detr_ops这个算子,排除这个自定义算子带来的影响。具体:
1.如果环境里面安装了deformable_detr_ops,可以先pip uninstall 删掉;
2.去除后,重新导出,试试python能不能正常跑;
3.如果python正常,再试试c++

from paddlemix.

TinyQi avatar TinyQi commented on June 21, 2024

可以试试去掉deformable_detr_ops这个算子,排除这个自定义算子带来的影响。具体: 1.如果环境里面安装了deformable_detr_ops,可以先pip uninstall 删掉; 2.去除后,重新导出,试试python能不能正常跑; 3.如果python正常,再试试c++

hello,我试过了,还是不行。请问您那边有在C++推理成功推理过不?

from paddlemix.

TinyQi avatar TinyQi commented on June 21, 2024

可以试试去掉deformable_detr_ops这个算子,排除这个自定义算子带来的影响。具体: 1.如果环境里面安装了deformable_detr_ops,可以先pip uninstall 删掉; 2.去除后,重新导出,试试python能不能正常跑; 3.如果python正常,再试试c++

请问,你们内部有成功过的例子不?还是说正在兼容当中啊

from paddlemix.

LokeZhou avatar LokeZhou commented on June 21, 2024

可以试试去掉deformable_detr_ops这个算子,排除这个自定义算子带来的影响。具体: 1.如果环境里面安装了deformable_detr_ops,可以先pip uninstall 删掉; 2.去除后,重新导出,试试python能不能正常跑; 3.如果python正常,再试试c++

请问,你们内部有成功过的例子不?还是说正在兼容当中啊

这个模型暂没做过c++推理,可以参考https://github.com/PaddlePaddle/Paddle-Inference-Demo/tree/master 里面的其他模型demo;若报错,可在这里面提issue https://github.com/PaddlePaddle/Paddle-Inference-Demo/issues?q=is%3Aopen+is%3Aissue

from paddlemix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.