mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-13 20:34:02 +08:00
Add delete pass, disable_trt_ops and enable_fixed_size_opt for serving
This commit is contained in:
@@ -144,6 +144,18 @@ TRITONSERVER_Error* FDParseShape(triton::common::TritonJson::Value& io,
|
|||||||
return nullptr; // success
|
return nullptr; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SplitStringByDelimiter(const std::string& s, char delimiter,
|
||||||
|
std::vector<std::string>* 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 fastdeploy_runtime
|
||||||
} // namespace backend
|
} // namespace backend
|
||||||
} // namespace triton
|
} // namespace triton
|
@@ -73,6 +73,10 @@ TRITONSERVER_Error* FDParseShape(triton::common::TritonJson::Value& io,
|
|||||||
const std::string& name,
|
const std::string& name,
|
||||||
std::vector<int32_t>* shape);
|
std::vector<int32_t>* shape);
|
||||||
|
|
||||||
|
int SplitStringByDelimiter(const std::string& s,
|
||||||
|
char delimiter,
|
||||||
|
std::vector<std::string>* results);
|
||||||
|
|
||||||
} // namespace fastdeploy_runtime
|
} // namespace fastdeploy_runtime
|
||||||
} // namespace backend
|
} // namespace backend
|
||||||
} // namespace triton
|
} // namespace triton
|
||||||
|
@@ -233,7 +233,8 @@ ModelState::ModelState(TRITONBACKEND_Model* triton_model)
|
|||||||
bool use_paddle_log;
|
bool use_paddle_log;
|
||||||
THROW_IF_BACKEND_MODEL_ERROR(
|
THROW_IF_BACKEND_MODEL_ERROR(
|
||||||
ParseBoolValue(value_string, &use_paddle_log));
|
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") {
|
} else if (param_key == "num_streams") {
|
||||||
int num_streams;
|
int num_streams;
|
||||||
THROW_IF_BACKEND_MODEL_ERROR(
|
THROW_IF_BACKEND_MODEL_ERROR(
|
||||||
@@ -320,12 +321,30 @@ ModelState::ModelState(TRITONBACKEND_Model* triton_model)
|
|||||||
bool use_paddle_log;
|
bool use_paddle_log;
|
||||||
THROW_IF_BACKEND_MODEL_ERROR(
|
THROW_IF_BACKEND_MODEL_ERROR(
|
||||||
ParseBoolValue(value_string, &use_paddle_log));
|
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") {
|
} else if (param_key == "is_clone") {
|
||||||
THROW_IF_BACKEND_MODEL_ERROR(
|
THROW_IF_BACKEND_MODEL_ERROR(
|
||||||
ParseBoolValue(value_string, &is_clone_));
|
ParseBoolValue(value_string, &is_clone_));
|
||||||
} else if (param_key == "encryption_key") {
|
} else if (param_key == "encryption_key") {
|
||||||
runtime_options_->SetEncryptionKey(value_string);
|
runtime_options_->SetEncryptionKey(value_string);
|
||||||
|
} else if (param_key == "disable_trt_ops") {
|
||||||
|
std::vector<std::string> 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<std::string> 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user