From 6815d8a182d0564d6776ea83bb22773c91dd067a Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Fri, 4 Apr 2025 09:22:16 -0400 Subject: [PATCH] enabled MPS support for easyOCR --- libs/som/som/ocr.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libs/som/som/ocr.py b/libs/som/som/ocr.py index a206e057..6d10e85a 100644 --- a/libs/som/som/ocr.py +++ b/libs/som/som/ocr.py @@ -67,17 +67,9 @@ class OCRProcessor: import easyocr # Use GPU if available - use_gpu = self.device in ["cuda"] # MPS not directly supported by EasyOCR - - # If using MPS, add warnings to explain why CPU is used - if self.device == "mps": - logger.warning("EasyOCR doesn't support MPS directly. Using CPU instead.") - logger.warning( - "To silence this warning, set environment variable: PYTORCH_ENABLE_MPS_FALLBACK=1" - ) - + use_gpu = self.device in ["cuda", "mps"] self.reader = easyocr.Reader(["en"], gpu=use_gpu) - + # Verify reader initialization if self.reader is None: raise ValueError("Failed to initialize EasyOCR reader")