fix: allow mps usage for easyocr (#286)

* fix: allow mps usage for easyocr

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>

* add example for cpu-only

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>

* comment out example

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>

---------

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
Michele Dolfi
2024-11-10 14:26:17 +01:00
committed by GitHub
parent be8aa17291
commit 97f214efdd
2 changed files with 15 additions and 4 deletions

View File

@@ -31,12 +31,9 @@ class EasyOcrModel(BaseOcrModel):
"Alternatively, Docling has support for other OCR engines. See the documentation."
)
use_gpu = (
False if torch.backends.mps.is_available() else self.options.use_gpu
)
self.reader = easyocr.Reader(
lang_list=self.options.lang,
gpu=use_gpu,
gpu=self.options.use_gpu,
model_storage_directory=self.options.model_storage_directory,
download_enabled=self.options.download_enabled,
)