diff --git a/python/paddle_serving_server/__init__.py b/python/paddle_serving_server/__init__.py index 76b04d613c956ed1ec2f4d72de0bb1ae0dcbdde5..e0164b496a458721e0e484b5c6bfa8d139eb5fdb 100644 --- a/python/paddle_serving_server/__init__.py +++ b/python/paddle_serving_server/__init__.py @@ -234,9 +234,24 @@ class Server(object): # of multiple models are the same workflow_oi_config_path = None if isinstance(model_config_paths, str): - # the default engine name is "general_infer" - self.model_config_paths = {"general_infer_0": model_config_paths} - workflow_oi_config_path = self.model_config_paths["general_infer_0"] + # If there is only one model path, use the default infer_op. + # Because there are several infer_op type, we need to find + # it from workflow_conf. + default_engine_names = [ + 'general_infer_0', 'general_dist_kv_infer_0', + 'general_dist_kv_quant_infer' + ] + engine_name = None + for node in self.workflow_conf.workflows[0].nodes: + if node.name in default_engine_names: + engine_name = node.name + break + if engine_name is None: + raise Exception( + "You have set the engine_name of Op. Please use the form {op: model_path} to configure model path" + ) + self.model_config_paths = {engine_name: model_config_paths} + workflow_oi_config_path = self.model_config_paths[engine_name] elif isinstance(model_config_paths, dict): self.model_config_paths = {} for node_str, path in model_config_paths.items(): diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 3c29448435e8b7de4e8cebe7b3d416197aadb5a2..981494e1a6281780cce633d755034e602dac39c1 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -269,9 +269,24 @@ class Server(object): # of multiple models are the same workflow_oi_config_path = None if isinstance(model_config_paths, str): - # the default engine name is "general_infer" - self.model_config_paths = {"general_infer_0": model_config_paths} - workflow_oi_config_path = self.model_config_paths["general_infer_0"] + # If there is only one model path, use the default infer_op. + # Because there are several infer_op type, we need to find + # it from workflow_conf. + default_engine_names = [ + 'general_infer_0', 'general_dist_kv_infer_0', + 'general_dist_kv_quant_infer' + ] + engine_name = None + for node in self.workflow_conf.nodes: + if node.name in default_engine_names: + engine_name = node.name + break + if engine_name is None: + raise Exception( + "You have set the engine_name of Op. Please use the form {op: model_path} to configure model path" + ) + self.model_config_paths = {engine_name: model_config_paths} + workflow_oi_config_path = self.model_config_paths[engine_name] elif isinstance(model_config_paths, dict): self.model_config_paths = {} for node_str, path in model_config_paths.items():