mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
Format code
This commit is contained in:
@@ -104,12 +104,14 @@ bool AutoSelectBackend(RuntimeOption& option) {
|
|||||||
|
|
||||||
bool Runtime::Init(const RuntimeOption& _option) {
|
bool Runtime::Init(const RuntimeOption& _option) {
|
||||||
option = _option;
|
option = _option;
|
||||||
|
// decrypt encrypted model
|
||||||
if ("" != option.encryption_key_) {
|
if ("" != option.encryption_key_) {
|
||||||
#ifdef ENABLE_ENCRYPTION
|
#ifdef ENABLE_ENCRYPTION
|
||||||
if (option.model_from_memory_) {
|
if (option.model_from_memory_) {
|
||||||
option.model_file = Decrypt(option.model_file, option.encryption_key_);
|
option.model_file = Decrypt(option.model_file, option.encryption_key_);
|
||||||
if (!(option.params_file.empty())) {
|
if (!(option.params_file.empty())) {
|
||||||
option.params_file = Decrypt(option.params_file, option.encryption_key_);
|
option.params_file =
|
||||||
|
Decrypt(option.params_file, option.encryption_key_);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::string model_buffer = "";
|
std::string model_buffer = "";
|
||||||
|
@@ -187,8 +187,7 @@ class RuntimeOption:
|
|||||||
return self._option.set_model_buffer(model_buffer, params_buffer,
|
return self._option.set_model_buffer(model_buffer, params_buffer,
|
||||||
model_format)
|
model_format)
|
||||||
|
|
||||||
def set_encryption_key(self,
|
def set_encryption_key(self, encryption_key):
|
||||||
encryption_key):
|
|
||||||
"""When loading encrypted model, encryption_key is required to decrypte model
|
"""When loading encrypted model, encryption_key is required to decrypte model
|
||||||
:param encryption_key: (str)The key for decrypting model
|
:param encryption_key: (str)The key for decrypting model
|
||||||
"""
|
"""
|
||||||
@@ -590,9 +589,11 @@ class RuntimeOption:
|
|||||||
replica_num=1,
|
replica_num=1,
|
||||||
available_memory_proportion=1.0,
|
available_memory_proportion=1.0,
|
||||||
enable_half_partial=False):
|
enable_half_partial=False):
|
||||||
logging.warning("`RuntimeOption.set_ipu_config` will be deprecated in v1.2.0, please use `RuntimeOption.paddle_infer_option.set_ipu_config()` instead.")
|
logging.warning(
|
||||||
self._option.paddle_infer_option.set_ipu_config(enable_fp16, replica_num,
|
"`RuntimeOption.set_ipu_config` will be deprecated in v1.2.0, please use `RuntimeOption.paddle_infer_option.set_ipu_config()` instead."
|
||||||
available_memory_proportion,
|
)
|
||||||
|
self._option.paddle_infer_option.set_ipu_config(
|
||||||
|
enable_fp16, replica_num, available_memory_proportion,
|
||||||
enable_half_partial)
|
enable_half_partial)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -664,7 +665,8 @@ class RuntimeOption:
|
|||||||
continue
|
continue
|
||||||
if hasattr(getattr(self._option, attr), "__call__"):
|
if hasattr(getattr(self._option, attr), "__call__"):
|
||||||
continue
|
continue
|
||||||
message += " {} : {}\t\n".format(attr, getattr(self._option, attr))
|
message += " {} : {}\t\n".format(attr,
|
||||||
|
getattr(self._option, attr))
|
||||||
message.strip("\n")
|
message.strip("\n")
|
||||||
message += ")"
|
message += ")"
|
||||||
return message
|
return message
|
||||||
|
Reference in New Issue
Block a user