- File:
backend/utils/ocr/easyocr_engine.py - Change: Line 21 changed from
gpu=Falsetogpu=True
Since you have CUDA 11.8 and cuDNN installed, run this command in your virtual environment:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118This will:
- Install PyTorch compiled with CUDA 11.8 support
- Install torchvision and torchaudio with matching CUDA support
- Replace any existing CPU-only PyTorch installation
After installation, verify GPU is detected:
python -c "import torch; print(f'CUDA Available: {torch.cuda.is_available()}'); print(f'CUDA Version: {torch.version.cuda}'); print(f'GPU Device: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"None\"}')"Expected output:
CUDA Available: True
CUDA Version: 11.8
GPU Device: [Your GPU Name]
# Stop current server (Ctrl+C)
# Start again
uvicorn backend.main:app --reload- Upload a scanned PDF document
- Check backend logs for OCR processing
- GPU acceleration should significantly speed up processing (2-5x faster)
While OCR is running, check GPU usage:
nvidia-smi- Single page (CPU): 3-5 seconds
- Single page (GPU): 0.5-1.5 seconds
- 10-page document (CPU): 30-50 seconds
- 10-page document (GPU): 5-15 seconds
- Verify CUDA installation:
nvcc --version - Verify cuDNN is installed
- Check PyTorch CUDA version matches your CUDA:
python -c "import torch; print(torch.version.cuda)" - Reinstall PyTorch with correct CUDA version
- EasyOCR loads models into GPU memory (~1-2GB)
- Reduce batch size or process fewer pages at once
- Close other GPU-intensive applications
If GPU issues persist, change back to gpu=False in easyocr_engine.py
- Install PyTorch with CUDA support (command above)
- Restart backend server
- Test with scanned documents
- Monitor performance improvements
- Verify rotation detection and table extraction work correctly