robertknight / ocrs

Rust library and CLI tool for OCR (extracting text from images)
Apache License 2.0
1.09k stars 44 forks source link

Illegal instruction (virtualized CPU under Proxmox 8) #49

Closed dawidthegreat closed 4 months ago

dawidthegreat commented 4 months ago

Downloading https://ocrs-models.s3-accelerate.amazonaws.com/text-detection.rten... Downloading https://ocrs-models.s3-accelerate.amazonaws.com/text-recognition.rten... Illegal instruction

Running a jpg and get illegal instruction with the two files above. Have tried on more than one OC/Machine.

robertknight commented 4 months ago

What operating system and version are you using, and what CPU(s) do the machines have? I'm aware of a reported issue when running older versions of the library under Rosetta emulation on Apple Silicon. See https://github.com/robertknight/rten/issues/35. The workaround for the moment is to compile natively for Arm.

dawidthegreat commented 4 months ago

The OS's have been:

Ubuntu 24.04 Ubuntu 22.04 Centos 7

CPU's are virtualised on Proxmox 8. I'll try on a bare metal machine and see if I still get the error.

dawidthegreat commented 4 months ago

It was fixed by changing the cpu type to host on proxmox virtualisation. It is based on qemu so should be applicable on machines using that. Result is perfect, the text recognition is superb.

robertknight commented 4 months ago

Thanks for the info. Ocrs uses AVX-2 / FMA instructions if available on x64 CPUs, so there might be an issue with misdetecting whether they are available in this virtualized environment.

dawidthegreat commented 4 months ago

Possibly, it was on the default CPU which is X86-64-V2-AES, a virtualised CPU. By selecting host from the menu solved the issue I guess by pass through functionality.