ocrmypdf / OCRmyPDF-EasyOCR

OCRmyPDF EasyOCR plugin
MIT License
34 stars 6 forks source link

Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU. #2

Closed isspid closed 10 months ago

isspid commented 10 months ago

While running ocrmypdf with EasyOCR as an engine I get the following output. When using EasyOCR not as part of ocrmypdf I have actually not had any problems with using the GPU.

Start processing 11 pages concurrently                                                                                                                                            _sync.py:259    
1 redoing OCR                                                                                                                                                             _pipeline.py:309    
2 redoing OCR                                                                                                                                                             _pipeline.py:309    
3 redoing OCR                                                                                                                                                             _pipeline.py:309    
4 redoing OCR                                                                                                                                                             _pipeline.py:309    
5 redoing OCR                                                                                                                                                             _pipeline.py:309    
6 redoing OCR                                                                                                                                                             _pipeline.py:309    
7 redoing OCR                                                                                                                                                             _pipeline.py:309    
8 redoing OCR                                                                                                                                                             _pipeline.py:309    
9 redoing OCR                                                                                                                                                             _pipeline.py:309   
10 redoing OCR                                                                                                                                                             _pipeline.py:309   
11 redoing OCR                                                                                                                                                             _pipeline.py:309   
11 Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU.                                                                       easyocr.py:80    
4 Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU.                                                                       easyocr.py:80
isspid commented 10 months ago

It seems that actually when I run EasyOCR in this environment, the GPU also doesn't get used. In another environment the GPU does get used. Could it be that the way pytorch was installed is the incorrect one?

isspid commented 10 months ago

Created a new conda environment with python 3.10. First installed pytorch with this command: pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117 which I got from the official pytorch website. Then I installed ocrmypd and finally I ran: pip install git+https://github.com/ocrmypdf/OCRmyPDF-EasyOCR.git. Now everything is working fine.