Skip to content
Discussion options

You must be logged in to vote
  1. Download a decoder & mmproj gguf via Huggingface
  2. Run latest llama.cpp server binary with command 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 -m and --mmproj paths with the GGUFs you downloaded)

(seems like flash-attn must be off for it to work currently.)

  1. in a Python script, call the llama-server GLM-OCR model like so:
import base64
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8080/v1", api_key="blahblah-probablynotneeded")

def encode_image(path):
    with open(path, "rb") as f:
        return base64.b64encode(f.read()).decode("utf-8")

# Path to your local image
image_path = …

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@xms991
Comment options

@SmartestWashingMachine
Comment options

Answer selected by mrsipan
Comment options

You must be logged in to vote
4 replies
@xms991
Comment options

@MartinEls
Comment options

@xms991
Comment options

@Disonantemus
Comment options

Comment options

You must be logged in to vote
2 replies
@xms991
Comment options

@xms991
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants