From 3ba4ace7e07b818302bc2955e9a96ccc5ce0c3ae Mon Sep 17 00:00:00 2001 From: Victor Kuznetsov Date: Wed, 19 Aug 2026 10:22:58 -0700 Subject: [PATCH] Disable mkldnn in the draft engines (linux PIR crash) --- src/remove_ai_watermarks/text_draft.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/remove_ai_watermarks/text_draft.py b/src/remove_ai_watermarks/text_draft.py index 3e4920e..96256a6 100644 --- a/src/remove_ai_watermarks/text_draft.py +++ b/src/remove_ai_watermarks/text_draft.py @@ -198,16 +198,21 @@ def draft_available() -> bool: def _build_engines() -> tuple[Any, dict[str, Any]]: from paddleocr import PaddleOCR, TextRecognition + # enable_mkldnn=False is load-bearing on linux: paddle's oneDNN PIR executor + # raises NotImplementedError on the text-detection graph there (seen on the + # Modal draft container, 2026-08-19), while the reference CPU path runs. The + # eval scripts never hit it because macOS pads take a different path. detector = PaddleOCR( lang="ch", use_doc_orientation_classify=False, use_doc_unwarping=False, use_textline_orientation=False, + enable_mkldnn=False, ) engines = { - "en": TextRecognition(model_name="en_PP-OCRv5_mobile_rec"), - "ru": TextRecognition(model_name="eslav_PP-OCRv5_mobile_rec"), - "ch": TextRecognition(model_name="PP-OCRv5_server_rec"), + "en": TextRecognition(model_name="en_PP-OCRv5_mobile_rec", enable_mkldnn=False), + "ru": TextRecognition(model_name="eslav_PP-OCRv5_mobile_rec", enable_mkldnn=False), + "ch": TextRecognition(model_name="PP-OCRv5_server_rec", enable_mkldnn=False), } return detector, engines