Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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,
)
),
)
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down