From eca2ae8b942786f842d14289a2ba14f79e88fad5 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 19 Nov 2024 16:32:26 +0800 Subject: [PATCH 1/2] fix: build error without ENABLE_PADDLE2ONNX --- fastdeploy/runtime/backends/ort/ort_backend.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fastdeploy/runtime/backends/ort/ort_backend.cc b/fastdeploy/runtime/backends/ort/ort_backend.cc index db1f03e40b..433f83d5f7 100644 --- a/fastdeploy/runtime/backends/ort/ort_backend.cc +++ b/fastdeploy/runtime/backends/ort/ort_backend.cc @@ -260,8 +260,13 @@ bool OrtBackend::InitFromOnnx(const std::string& model_file, } char* model_content_ptr; int model_content_size = 0; +#ifdef ENABLE_PADDLE2ONNX paddle2onnx::ConvertFP32ToFP16(model_file.c_str(), model_file.size(), &model_content_ptr, &model_content_size); +#else + FDERROR << "Didn't compile with PaddlePaddle Frontend, FP16 is not supported" << std::endl; + return false; +#endif std::string onnx_model_proto(model_content_ptr, model_content_ptr + model_content_size); delete[] model_content_ptr; From 11214a642f4bd75838076042e85b4fae4322b6be Mon Sep 17 00:00:00 2001 From: MistEO Date: Thu, 21 Nov 2024 16:11:31 +0800 Subject: [PATCH 2/2] fix: typo of log --- fastdeploy/runtime/backends/ort/ort_backend.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastdeploy/runtime/backends/ort/ort_backend.cc b/fastdeploy/runtime/backends/ort/ort_backend.cc index 433f83d5f7..705c8dbf9e 100644 --- a/fastdeploy/runtime/backends/ort/ort_backend.cc +++ b/fastdeploy/runtime/backends/ort/ort_backend.cc @@ -264,7 +264,7 @@ bool OrtBackend::InitFromOnnx(const std::string& model_file, paddle2onnx::ConvertFP32ToFP16(model_file.c_str(), model_file.size(), &model_content_ptr, &model_content_size); #else - FDERROR << "Didn't compile with PaddlePaddle Frontend, FP16 is not supported" << std::endl; + FDERROR << "Didn't compile with ENABLE_PADDLE2ONNX, FP16 is not supported" << std::endl; return false; #endif std::string onnx_model_proto(model_content_ptr,