Skip to content

⚡ Bolt: [performance improvement] Optimize YOLO predictions with verbose=False#18

Draft
kingkillery wants to merge 1 commit into
mainfrom
bolt-optimize-yolo-predict-11795846412233117074
Draft

⚡ Bolt: [performance improvement] Optimize YOLO predictions with verbose=False#18
kingkillery wants to merge 1 commit into
mainfrom
bolt-optimize-yolo-predict-11795846412233117074

Conversation

@kingkillery
Copy link
Copy Markdown
Owner

@kingkillery kingkillery commented Apr 13, 2026

💡 What: Added verbose=False to the self.model.predict() calls within commonforms/inference.py.

🎯 Why: Ultralytics YOLO models print bounding box predictions and model details to stdout synchronously for every prediction call by default. When running inference inside list comprehension loops or through batching, these console logs block the main thread, introducing significant I/O latency that degrades overall inference performance.

📊 Impact: Eliminates unnecessary stdout I/O blocking during inference tasks, making the widget extraction phase noticeably faster, especially when processing multi-page documents or when operating in fast mode (ONNX loop).

🔬 Measurement: Verified code runs successfully by executing the test suite (uv run pytest tests/) and ensuring it completes successfully and doesn't crash on standard PDFs. Time profiling inference runs natively should verify faster times for batch/multi-page inference.


PR created automatically by Jules for task 11795846412233117074 started by @kingkillery

Summary by CodeRabbit

  • Bug Fixes

    • Improved widget extraction performance by suppressing verbose output during model inference operations, reducing I/O latency and thread blocking in batch processing workflows.
  • Documentation

    • Added internal documentation detailing model inference performance considerations and recommended optimization practices for production and high-throughput scenarios.

… stdout blocking

Co-authored-by: kingkillery <200727508+kingkillery@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

Walkthrough

Added a documentation note describing a YOLO synchronous stdout bottleneck, then implemented the recommended fix by adding verbose=False to YOLO prediction calls within the widget extraction inference pipeline to suppress output and reduce I/O latency during batch processing.

Changes

Cohort / File(s) Summary
Documentation
.jules/bolt.md
New dated entry documenting YOLO stdout bottleneck and recommending verbose=False parameter for production inference.
Inference Implementation
commonforms/inference.py
Added verbose=False parameter to YOLO .predict() calls in both fast/ONNX and non-fast inference paths within widget extraction to suppress prediction-time output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A note of caution, a whisper so slight,
YOLO's chatter dimmed—now inference flows light!
Verbose=False, the remedy we seek,
No more stdout blockades, smooth and sleek.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references the main change (adding verbose=False to YOLO predictions) and accurately describes the performance optimization being implemented.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-optimize-yolo-predict-11795846412233117074

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.jules/bolt.md:
- Around line 1-3: Update the entry header date to the PR's actual date by
changing the heading text "## 2024-04-13 - Ultralytics YOLO Synchronous stdout
Bottleneck" to "## 2026-04-13 - Ultralytics YOLO Synchronous stdout Bottleneck"
so the timeline in .jules/bolt.md matches the change; leave the rest of the note
(the Learning and Action lines) unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e754ee27-6c58-4ee6-80f0-50f739561090

📥 Commits

Reviewing files that changed from the base of the PR and between e00f2d1 and adece0e.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • commonforms/inference.py

Comment thread .jules/bolt.md
Comment on lines +1 to +3
## 2024-04-13 - Ultralytics YOLO Synchronous stdout Bottleneck
**Learning:** Ultralytics YOLO models by default print bounding box predictions and model details to stdout synchronously for every prediction call. Inside of loops or high-throughput batching, this blocks the main thread and introduces significant I/O latency, tanking performance.
**Action:** Always set `verbose=False` inside `.predict()` when using YOLO models in production or batch loops where logs are not explicitly needed.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix the note date to match this change’s actual date.

The heading says 2024-04-13, but this PR was created on 2026-04-13. Keeping the exact date aligned avoids timeline confusion in project learnings.

🛠️ Proposed doc fix
-## 2024-04-13 - Ultralytics YOLO Synchronous stdout Bottleneck
+## 2026-04-13 - Ultralytics YOLO Synchronous stdout Bottleneck
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 2024-04-13 - Ultralytics YOLO Synchronous stdout Bottleneck
**Learning:** Ultralytics YOLO models by default print bounding box predictions and model details to stdout synchronously for every prediction call. Inside of loops or high-throughput batching, this blocks the main thread and introduces significant I/O latency, tanking performance.
**Action:** Always set `verbose=False` inside `.predict()` when using YOLO models in production or batch loops where logs are not explicitly needed.
## 2026-04-13 - Ultralytics YOLO Synchronous stdout Bottleneck
**Learning:** Ultralytics YOLO models by default print bounding box predictions and model details to stdout synchronously for every prediction call. Inside of loops or high-throughput batching, this blocks the main thread and introduces significant I/O latency, tanking performance.
**Action:** Always set `verbose=False` inside `.predict()` when using YOLO models in production or batch loops where logs are not explicitly needed.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.jules/bolt.md around lines 1 - 3, Update the entry header date to the PR's
actual date by changing the heading text "## 2024-04-13 - Ultralytics YOLO
Synchronous stdout Bottleneck" to "## 2026-04-13 - Ultralytics YOLO Synchronous
stdout Bottleneck" so the timeline in .jules/bolt.md matches the change; leave
the rest of the note (the Learning and Action lines) unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant