mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-07 17:41:52 +08:00
[Backend] Add OCR、Seg、 KeypointDetection、Matting、 ernie-3.0 and adaface models for XPU Deploy (#960)
* [FlyCV] Bump up FlyCV -> official release 1.0.0 * add seg models for XPU * add ocr model for XPU * add matting * add matting python * fix infer.cc * add keypointdetection support for XPU * Add adaface support for XPU * add ernie-3.0 * fix doc Co-authored-by: DefTruth <qiustudent_r@163.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com>
This commit is contained in:
19
examples/text/ernie-3.0/cpp/seq_cls_infer.cc
Normal file → Executable file
19
examples/text/ernie-3.0/cpp/seq_cls_infer.cc
Normal file → Executable file
@@ -32,7 +32,7 @@ const char sep = '/';
|
||||
DEFINE_string(model_dir, "", "Directory of the inference model.");
|
||||
DEFINE_string(vocab_path, "", "Path of the vocab file.");
|
||||
DEFINE_string(device, "cpu",
|
||||
"Type of inference device, support 'cpu' or 'gpu'.");
|
||||
"Type of inference device, support 'cpu', 'xpu' or 'gpu'.");
|
||||
DEFINE_string(backend, "onnx_runtime",
|
||||
"The inference runtime backend, support: ['onnx_runtime', "
|
||||
"'paddle', 'openvino', 'tensorrt', 'paddle_tensorrt']");
|
||||
@@ -55,7 +55,16 @@ void PrintUsage() {
|
||||
}
|
||||
|
||||
bool CreateRuntimeOption(fastdeploy::RuntimeOption* option) {
|
||||
if (FLAGS_device == "gpu") {
|
||||
std::string model_path = FLAGS_model_dir + sep + "infer.pdmodel";
|
||||
std::string param_path = FLAGS_model_dir + sep + "infer.pdiparams";
|
||||
fastdeploy::FDINFO << "model_path = " << model_path
|
||||
<< ", param_path = " << param_path << std::endl;
|
||||
option->SetModelPath(model_path, param_path);
|
||||
|
||||
if (FLAGS_device == "xpu") {
|
||||
option->UseXpu();
|
||||
return true;
|
||||
} else if (FLAGS_device == "gpu") {
|
||||
option->UseGpu();
|
||||
} else if (FLAGS_device == "cpu") {
|
||||
option->UseCpu();
|
||||
@@ -97,11 +106,7 @@ bool CreateRuntimeOption(fastdeploy::RuntimeOption* option) {
|
||||
<< FLAGS_backend << "'" << std::endl;
|
||||
return false;
|
||||
}
|
||||
std::string model_path = FLAGS_model_dir + sep + "infer.pdmodel";
|
||||
std::string param_path = FLAGS_model_dir + sep + "infer.pdiparams";
|
||||
fastdeploy::FDINFO << "model_path = " << model_path
|
||||
<< ", param_path = " << param_path << std::endl;
|
||||
option->SetModelPath(model_path, param_path);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user