diff --git a/serving/src/fastdeploy_backend_utils.cc b/serving/src/fastdeploy_backend_utils.cc index 2d151253e..400052b25 100644 --- a/serving/src/fastdeploy_backend_utils.cc +++ b/serving/src/fastdeploy_backend_utils.cc @@ -144,6 +144,18 @@ TRITONSERVER_Error* FDParseShape(triton::common::TritonJson::Value& io, return nullptr; // success } +int SplitStringByDelimiter(const std::string& s, char delimiter, + std::vector* results) { + std::string token; + std::istringstream token_stream(s); + int number_of_tokens = 0; + while (std::getline(token_stream, token, delimiter)) { + results->push_back(token); + number_of_tokens += 1; + } + return number_of_tokens; +} + } // namespace fastdeploy_runtime } // namespace backend } // namespace triton \ No newline at end of file diff --git a/serving/src/fastdeploy_backend_utils.h b/serving/src/fastdeploy_backend_utils.h index 64119f9fa..2db6b6bf0 100644 --- a/serving/src/fastdeploy_backend_utils.h +++ b/serving/src/fastdeploy_backend_utils.h @@ -73,6 +73,10 @@ TRITONSERVER_Error* FDParseShape(triton::common::TritonJson::Value& io, const std::string& name, std::vector* shape); +int SplitStringByDelimiter(const std::string& s, + char delimiter, + std::vector* results); + } // namespace fastdeploy_runtime } // namespace backend } // namespace triton diff --git a/serving/src/fastdeploy_runtime.cc b/serving/src/fastdeploy_runtime.cc index c69fbf3d1..75f5c672f 100644 --- a/serving/src/fastdeploy_runtime.cc +++ b/serving/src/fastdeploy_runtime.cc @@ -233,7 +233,8 @@ ModelState::ModelState(TRITONBACKEND_Model* triton_model) bool use_paddle_log; THROW_IF_BACKEND_MODEL_ERROR( ParseBoolValue(value_string, &use_paddle_log)); - runtime_options_->paddle_infer_option.enable_log_info = use_paddle_log; + runtime_options_->paddle_infer_option.enable_log_info = + use_paddle_log; } else if (param_key == "num_streams") { int num_streams; THROW_IF_BACKEND_MODEL_ERROR( @@ -320,12 +321,30 @@ ModelState::ModelState(TRITONBACKEND_Model* triton_model) bool use_paddle_log; THROW_IF_BACKEND_MODEL_ERROR( ParseBoolValue(value_string, &use_paddle_log)); - runtime_options_->paddle_infer_option.enable_log_info = use_paddle_log; + runtime_options_->paddle_infer_option.enable_log_info = + use_paddle_log; } else if (param_key == "is_clone") { THROW_IF_BACKEND_MODEL_ERROR( ParseBoolValue(value_string, &is_clone_)); } else if (param_key == "encryption_key") { runtime_options_->SetEncryptionKey(value_string); + } else if (param_key == "disable_trt_ops") { + std::vector disable_trt_ops; + SplitStringByDelimiter(value_string, ' ', &disable_trt_ops); + runtime_options_->paddle_infer_option.DisablePaddleTrtOPs( + disable_trt_ops); + } else if (param_key == "delete_passes") { + std::vector delete_passes; + SplitStringByDelimiter(value_string, ' ', &disable_trt_ops); + for (auto&& pass : delete_passes) { + runtime_options_->paddle_infer_option.DeletePass(pass); + } + } else if (param_key == "enable_fixed_size_opt") { + bool enable_fixed_size_opt = false; + THROW_IF_BACKEND_MODEL_ERROR( + ParseBoolValue(value_string, &enable_fixed_size_opt)); + runtime_options_->paddle_infer_option.enable_fixed_size_opt = + enable_fixed_size_opt; } } }