diff --git a/deploy/hps/sdk/pipelines/PaddleOCR-VL/server/model_repo/layout-parsing/1/model.py b/deploy/hps/sdk/pipelines/PaddleOCR-VL/server/model_repo/layout-parsing/1/model.py index 75c96504f..2e8e008e1 100644 --- a/deploy/hps/sdk/pipelines/PaddleOCR-VL/server/model_repo/layout-parsing/1/model.py +++ b/deploy/hps/sdk/pipelines/PaddleOCR-VL/server/model_repo/layout-parsing/1/model.py @@ -81,7 +81,7 @@ def get_result_model_type(self): return schemas.paddleocr_vl.InferResult def run(self, input, log_id): - return self.run_batch([input], [log_id]) + return self.run_batch([input], [log_id], log_id) def run_batch(self, inputs, log_ids, batch_id): result_or_output_dic = {} @@ -170,24 +170,39 @@ def run_batch(self, inputs, log_ids, batch_id): return [result_or_output_dic[i] for i in range(len(inputs))] def _group_inputs(self, inputs): + def _to_hashable(obj): + if isinstance(obj, list): + return tuple(obj) + elif isinstance(obj, dict): + return tuple(sorted(obj.items())) + else: + return obj + def _hash(input): return hash( - ( - input.useDocOrientationClassify, - input.useDocUnwarping, - input.useLayoutDetection, - input.useChartRecognition, - input.layoutThreshold, - input.layoutNms, - input.layoutUnclipRatio, - input.layoutMergeBboxesMode, - input.promptLabel, - input.formatBlockContent, - input.repetitionPenalty, - input.temperature, - input.topP, - input.minPixels, - input.maxPixels, + tuple( + map( + _to_hashable, + ( + ( + input.useDocOrientationClassify, + input.useDocUnwarping, + input.useLayoutDetection, + input.useChartRecognition, + input.layoutThreshold, + input.layoutNms, + input.layoutUnclipRatio, + input.layoutMergeBboxesMode, + input.promptLabel, + input.formatBlockContent, + input.repetitionPenalty, + input.temperature, + input.topP, + input.minPixels, + input.maxPixels, + ) + ), + ) ) ) diff --git a/deploy/hps/server_env/paddlex-hps-server/src/paddlex_hps_server/base_model.py b/deploy/hps/server_env/paddlex-hps-server/src/paddlex_hps_server/base_model.py index 09dc40df2..a09262bb0 100644 --- a/deploy/hps/server_env/paddlex-hps-server/src/paddlex_hps_server/base_model.py +++ b/deploy/hps/server_env/paddlex-hps-server/src/paddlex_hps_server/base_model.py @@ -91,6 +91,7 @@ def execute(self, requests): log_ids = [] for i, request in enumerate(requests): log_id = protocol.generate_log_id() + logging.info("Request %s received", log_id) log_ids.append(log_id) input_ = pb_utils.get_input_tensor_by_name( request, constants.INPUT_NAME