From 550d887cdf15f50f9eda0fb862c4d269fb97b09b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 11:16:13 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Disable=20YOLO=20verbose=20?= =?UTF-8?q?mode=20to=20reduce=20I/O=20overhead?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added `verbose=False` to `model.predict()` in `commonforms/inference.py` to prevent synchronous stdout blocking overhead during inference loops. Co-authored-by: kingkillery <200727508+kingkillery@users.noreply.github.com> --- .jules/bolt.md | 3 +++ commonforms/inference.py | 4 ++++ plan.md | 9 +++++++++ 3 files changed, 16 insertions(+) create mode 100644 .jules/bolt.md create mode 100644 plan.md diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..4d11bf5 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2024-05-24 - Ultralytics YOLO Synchronous Logging Overhead +**Learning:** Calling `model.predict()` in Ultralytics YOLO with the default settings causes synchronous stdout writes that can introduce blocking overhead, especially when called inside loops or handling multiple items. +**Action:** Always explicitly pass `verbose=False` to `model.predict()` unless debugging output is actively required. This prevents unnecessary I/O overhead. diff --git a/commonforms/inference.py b/commonforms/inference.py index 527925f..1f2b1f6 100644 --- a/commonforms/inference.py +++ b/commonforms/inference.py @@ -124,6 +124,8 @@ def extract_widgets( conf=confidence, augment=False, imgsz=ONNX_IMAGE_SIZE, + # Disable verbose to prevent synchronous stdout blocking overhead + verbose=False, ) for p in pages ] @@ -135,6 +137,8 @@ def extract_widgets( augment=True, imgsz=image_size, device=self.device, + # Disable verbose to prevent synchronous stdout blocking overhead + verbose=False, ) widgets = {} diff --git a/plan.md b/plan.md new file mode 100644 index 0000000..b21c169 --- /dev/null +++ b/plan.md @@ -0,0 +1,9 @@ +1. **Optimize YOLO `model.predict` in `commonforms/inference.py`** + - Pass `verbose=False` to `self.model.predict()` in both the fast-mode loop and the batch-mode call. This prevents synchronous stdout blocking overhead when processing many pages, making the inference step measurably faster. + - Add a comment explaining the optimization. +2. **Add a journal entry in `.jules/bolt.md`** + - Create/update `.jules/bolt.md` recording the performance bottleneck caused by Ultralytics YOLO synchronous stdout blocking overhead. +3. **Pre-commit checks** + - Complete pre-commit steps to ensure proper testing, verification, review, and reflection are done. +4. **Submit** + - Create a PR with title `⚡ Bolt: [performance improvement]` and the required description format.