From 946ea1c2cba0643ec02447c667286bf8a31388be Mon Sep 17 00:00:00 2001 From: Nikos Livathinos Date: Thu, 28 Aug 2025 15:14:51 +0200 Subject: [PATCH] chore: Replace the layout_predictor.predict_batch() with layout_predictor.predict() in a loop Signed-off-by: Nikos Livathinos --- docling/models/layout_model.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docling/models/layout_model.py b/docling/models/layout_model.py index 38661a24..ecb10bd4 100644 --- a/docling/models/layout_model.py +++ b/docling/models/layout_model.py @@ -171,9 +171,12 @@ class LayoutModel(BasePageModel): batch_predictions = [] if valid_page_images: with TimeRecorder(conv_res, "layout"): - batch_predictions = self.layout_predictor.predict_batch( # type: ignore[attr-defined] - valid_page_images - ) + # batch_predictions = self.layout_predictor.predict_batch( # type: ignore[attr-defined] + # valid_page_images + # ) + for vpi in valid_page_images: + all_predictions = list(self.layout_predictor.predict(vpi)) + batch_predictions.append(all_predictions) # Process each page with its predictions valid_page_idx = 0