mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-07 01:22:59 +08:00
[Backend] support ort offline graph optimize option (#2268)
* support ort offline graph optimize option * support ort offline graph optimize option
This commit is contained in:
@@ -48,6 +48,8 @@ struct OrtBackendOption {
|
||||
void* external_stream_ = nullptr;
|
||||
/// Use fp16 to infer
|
||||
bool enable_fp16 = false;
|
||||
/// file path for optimized model
|
||||
std::string optimized_model_filepath;
|
||||
|
||||
std::vector<std::string> ort_disabled_ops_{};
|
||||
void DisableOrtFP16OpTypes(const std::vector<std::string>& ops) {
|
||||
|
@@ -46,6 +46,9 @@ bool OrtBackend::BuildOption(const OrtBackendOption& option) {
|
||||
if (option.execution_mode >= 0) {
|
||||
session_options_.SetExecutionMode(ExecutionMode(option.execution_mode));
|
||||
}
|
||||
if (!option.optimized_model_filepath.empty()) {
|
||||
session_options_.SetOptimizedModelFilePath(option.optimized_model_filepath.c_str());
|
||||
}
|
||||
|
||||
#ifdef WITH_DIRECTML
|
||||
// If use DirectML
|
||||
|
@@ -108,6 +108,8 @@ struct FASTDEPLOY_DECL Runtime {
|
||||
return backend_->benchmark_result_.time_of_runtime;
|
||||
}
|
||||
|
||||
bool Initialized() const { return backend_->Initialized(); }
|
||||
|
||||
private:
|
||||
void CreateOrtBackend();
|
||||
void CreatePaddleBackend();
|
||||
|
@@ -62,11 +62,11 @@ __build_fastdeploy_linux_x86_64_shared() {
|
||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DWITH_GPU=OFF \
|
||||
-DENABLE_ORT_BACKEND=ON \
|
||||
-DENABLE_PADDLE_BACKEND=ON \
|
||||
-DENABLE_OPENVINO_BACKEND=ON \
|
||||
-DENABLE_PADDLE_BACKEND=OFF \
|
||||
-DENABLE_OPENVINO_BACKEND=OFF \
|
||||
-DENABLE_PADDLE2ONNX=ON \
|
||||
-DENABLE_VISION=ON \
|
||||
-DENABLE_BENCHMARK=ON \
|
||||
-DENABLE_VISION=OFF \
|
||||
-DENABLE_BENCHMARK=OFF \
|
||||
-DENABLE_FLYCV=OFF \
|
||||
-DWITH_FLYCV_STATIC=OFF \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
@@ -84,11 +84,11 @@ __build_fastdeploy_linux_x86_64_shared_custom_paddle() {
|
||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DWITH_GPU=OFF \
|
||||
-DENABLE_ORT_BACKEND=ON \
|
||||
-DENABLE_PADDLE_BACKEND=ON \
|
||||
-DENABLE_OPENVINO_BACKEND=ON \
|
||||
-DENABLE_PADDLE_BACKEND=OFF \
|
||||
-DENABLE_OPENVINO_BACKEND=OFF \
|
||||
-DENABLE_PADDLE2ONNX=ON \
|
||||
-DENABLE_VISION=ON \
|
||||
-DENABLE_BENCHMARK=ON \
|
||||
-DENABLE_VISION=OFF \
|
||||
-DENABLE_BENCHMARK=OFF \
|
||||
-DPADDLEINFERENCE_DIRECTORY=${PADDLEINFERENCE_DIRECTORY} \
|
||||
-DPADDLEINFERENCE_VERSION=${PADDLEINFERENCE_VERSION} \
|
||||
-DENABLE_FLYCV=OFF \
|
||||
|
Reference in New Issue
Block a user