From e15c02c2925abe42c6ca687f96409c7ee0a52853 Mon Sep 17 00:00:00 2001 From: MRXLT Date: Tue, 18 Feb 2020 11:51:11 +0800 Subject: [PATCH] fix bug && add use_local_bin --- python/paddle_serving_server/__init__.py | 11 +++++++++-- python/paddle_serving_server_gpu/__init__.py | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/python/paddle_serving_server/__init__.py b/python/paddle_serving_server/__init__.py index e07f5c7e..b7458e93 100644 --- a/python/paddle_serving_server/__init__.py +++ b/python/paddle_serving_server/__init__.py @@ -81,11 +81,13 @@ class Server(object): self.general_model_config_fn = "general_model.prototxt" self.workdir = "" self.max_concurrency = 0 - self.num_threads = 0 + self.num_threads = 4 self.port = 8080 self.reload_interval_s = 10 self.module_path = os.path.dirname(paddle_serving_server.__file__) self.cur_path = os.getcwd() + self.vlog_level = 0 + self.use_local_bin = False def set_max_concurrency(self, concurrency): self.max_concurrency = concurrency @@ -108,6 +110,10 @@ class Server(object): def set_memory_optimize(self, flag=False): self.memory_optimization = flag + def set_local_bin(self, path): + self.use_local_bin = True + self.bin_path = path + def _prepare_engine(self, model_config_path, device): if self.model_toolkit_conf == None: self.model_toolkit_conf = server_sdk.ModelToolkitConf() @@ -242,7 +248,8 @@ class Server(object): def run_server(self): # just run server with system command # currently we do not load cube - self.download_bin() + if not self.use_local_bin: + self.download_bin() command = "{} " \ "-enable_model_toolkit " \ "-inferservice_path {} " \ diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 88f2e6e1..dbd974da 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -81,11 +81,13 @@ class Server(object): self.general_model_config_fn = "general_model.prototxt" self.workdir = "" self.max_concurrency = 0 - self.num_threads = 0 + self.num_threads = 4 self.port = 8080 self.reload_interval_s = 10 self.module_path = os.path.dirname(paddle_serving_server.__file__) self.cur_path = os.getcwd() + self.vlog_level = 0 + self.use_local_bin = False def set_max_concurrency(self, concurrency): self.max_concurrency = concurrency @@ -108,6 +110,10 @@ class Server(object): def set_memory_optimize(self, flag=False): self.memory_optimization = flag + def set_local_bin(self, path): + self.use_local_bin = True + self.bin_path = path + def set_gpuid(self, gpuid=0): self.gpuid = gpuid @@ -226,7 +232,8 @@ class Server(object): def run_server(self): # just run server with system command # currently we do not load cube - self.download_bin() + if not self.use_local_bin: + self.download_bin() command = "{} " \ "-enable_model_toolkit " \ "-inferservice_path {} " \ -- GitLab