Don't pin memory if device not set to use an accelerator.
Fixes #1414
I just rebuilt this modification and tested it on AWS Lambda with Python 3.13, and checked that it works without any errors.
Before
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
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.
It's useful! Thanks!