diff --git a/python/paddle_serving_server/__init__.py b/python/paddle_serving_server/__init__.py index 6f85bdc54b426d4cbb596b97f5461c2b8e76edcd..70251cff90715241411105901bba1cd0581d7673 100644 --- a/python/paddle_serving_server/__init__.py +++ b/python/paddle_serving_server/__init__.py @@ -109,9 +109,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 check_local_bin(self): + if "SERVING_BIN" in os.environ: + self.use_local_bin = True + self.bin_path = os.environ["SERVING_BIN"] def _prepare_engine(self, model_config_path, device): if self.model_toolkit_conf == None: @@ -258,10 +259,11 @@ class Server(object): def run_server(self): # just run server with system command # currently we do not load cube + self.check_local_bin() if not self.use_local_bin: self.download_bin() else: - print("Use local bin") + print("Use local bin : {}".format(self.bin_path)) 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 1cb860c71447d9672dee8ec4cd48e7fcb62ca5f5..4372884a290bb98faf4416c2cb0e872bc4c76003 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -109,9 +109,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 check_local_bin(self): + if "SERVING_BIN" in os.environ: + self.use_local_bin = True + self.bin_path = os.environ["SERVING_BIN"] def set_gpuid(self, gpuid=0): self.gpuid = gpuid @@ -243,8 +244,11 @@ class Server(object): def run_server(self): # just run server with system command # currently we do not load cube + self.check_local_bin() if not self.use_local_bin: self.download_bin() + else: + print("Use local bin : {}".format(self.bin_path)) command = "{} " \ "-enable_model_toolkit " \ "-inferservice_path {} " \