You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Perf] Text OCR-det forced to CPU on MPS is ~12x slower in the batch path (Apple Silicon, torch backend) #5632
I have searched the MinerU Readme and found no similar bug report.
I have searched the MinerU Issues and found no similar bug report.
I have searched the MinerU Discussions and found no similar bug report.
🤖 Consult the online AI assistant for assistance | 在线 AI 助手咨询
I have consulted the online AI assistant but was unable to obtain a solution to the issue.
Description of the bug | 错误描述
phase ocr-det is too slow on Apple Silicon MacOS.
How to reproduce the bug | 如何复现
Commit 1cbdeba forces self.device = "cpu" for text det when device is MPS (mineru/model/_internal/pytorchocr/infer/predict_det.py L19-24), citing cold-start overhead, with no config/env toggle.
The batch path pads crops to a uniform shape, so MPS kernel compilation is paid once per shape, not per crop — the cold-start rationale mainly applies to the non-batch path. Could you re-evaluate for the batch path, or expose a switch (e.g. MINERU_OCR_DET_DEVICE), or force CPU only during warmup?
Operating System Mode | 操作系统类型
MacOS
Operating System Version| 操作系统版本
Darwin blabla-Studio.local 27.0.0 Darwin Kernel Version 27.0.0: Tue Aug 11 21:20:40 PDT 2026; root:xnu-13432.1.9~1/RELEASE_ARM64_T6020 arm64
Thanks for the report. We re-evaluated OCR text detection on Apple Silicon, including the batch path. MPS can be faster once warmed up, but its first inference still takes too long. The approaches we tested have not provided a satisfactory balance between startup latency, memory usage, and output consistency.
We will therefore keep ordinary OCR text detection on CPU when MPS is selected. This CPU fallback is specific to MPS. On other supported non-MPS accelerators, such as CUDA, det will continue to use the selected accelerator normally.
Activity
perf(runtime): disable NNPACK by default for CPU convolutions
test(perf): add CPU and MPS detector benchmark tools
myhloli commentedon Oct 12, 2026
Thanks for the report. We re-evaluated OCR text detection on Apple Silicon, including the batch path. MPS can be faster once warmed up, but its first inference still takes too long. The approaches we tested have not provided a satisfactory balance between startup latency, memory usage, and output consistency.
We will therefore keep ordinary OCR text detection on CPU when MPS is selected. This CPU fallback is specific to MPS. On other supported non-MPS accelerators, such as CUDA, det will continue to use the selected accelerator normally.