EasyOCR icon indicating copy to clipboard operation
EasyOCR copied to clipboard

Don't pin memory if device not set to use an accelerator.

Open brownsloth opened this issue 6 months ago • 3 comments

Fixes #1414

brownsloth avatar Jul 01 '25 17:07 brownsloth

I just rebuilt this modification and tested it on AWS Lambda with Python 3.13, and checked that it works without any errors.

Before

image

It had pin_memory warning even I setted EasyOCR with CPU only. It seems be occurred in pytorch.util.data.dataLoader option. But As I know, 'pin_memory' option works for sending GPU(cuda) synchronously. So when using CPU only envireonment, It makes warning.

After

there no warning with 'pin_memory'

Tested on:

  • OS : Amazon Linux 2023(AArch64)
  • Python: 3.13
  • Pytorch: 2.9
  • Device: ARM64 CPU(no CUDA) You can download .whl here : test release

codingbotPark avatar Aug 09 '25 14:08 codingbotPark

I don't have the expertise to know the real consequences of this 3-line change, but it looks reasonable to me. If testing this locally would help the maintainers to merge this PR, I'd be happy to give it a try.

micseydel avatar Oct 03 '25 22:10 micseydel

It's useful! Thanks!

HSLix avatar Nov 14 '25 16:11 HSLix