GLM-OCR: how to use it #19721
|
llama.cpp has added support for glm-ocr: But currently there is not examples of how to use it. Can someone provide examples of it? |
Replies: 3 comments 8 replies
(seems like flash-attn must be off for it to work currently.)
|
|
There SDK/cli tool is really good in terms of out-of-the-box performance for pdf2MD without parameter fiddling. If you want to feed a pdf into LLMs, it covers many relevant document classes. On a M-Series MAC, here is what worked for me: I downloaded the GGUFs from here ggml-org/GLM-OCR-GGUF (the Q8 gguf and the mmproj) and run them with: # brew install llama.cpp
llama-server -m models/GLM-OCR-Q8_0.gguf --mmproj models/mmproj-GLM-OCR-Q8_0.gguf -c 12000 -ngl 99 --flash-attn off -fit offThe model is now useable from the GLM OCR cli pipeline (this includes a second, smaller model for segmentation, these segments get then feed to the OCR model running with llama.cpp). # pip install glmocr
time glmocr parse testdocs/RFeynman_plentySpace.pdf --config config.yaml Take the config from the SDK repo and set Needs a bit less than 3 mins for a 7 page text heavy pdf, for denser scientific papers like this or this expect 5 to 10 mins on a M1 MacBook Air (imho not too bad for the quality and a 5y old Ultrabook). |
|
The table looks ok for me (you inserted 2x the original, so I don't see the issue). The checkbox area above is a bit inconsistent: It seems to ignore the address completely, maybe it makes sense to adjust the confidence scores that trigger the OCR steps for specific components. |






llama-server.exe -m glmocr-Q4_K_M.gguf --mmproj mmproj-glmocr-Q4_1.gguf -c 12000 -ngl 99 --flash-attn off -fit off(replace the-mand--mmprojpaths with the GGUFs you downloaded)(seems like flash-attn must be off for it to work currently.)