Skip to content

model: support GLM-OCR#19677

Merged
ngxson merged 2 commits intoggml-org:masterfrom
ngxson:xsn/glm_ocr
Feb 18, 2026
Merged

model: support GLM-OCR#19677
ngxson merged 2 commits intoggml-org:masterfrom
ngxson:xsn/glm_ocr

Conversation

@ngxson
Copy link
Collaborator

@ngxson ngxson commented Feb 16, 2026

Fix #19335

Target support https://huggingface.co/zai-org/GLM-OCR

The model is just GLM4V under the hood with some additional features (see below), the transformers code already reflected most of the differences:

  1. Text model has one nextn MTP layer (similar to GLM4_MOE)
  2. Vision model uses Q/K norm, no learned positional embeddings

GGUF: to be uploaded...

@ngxson ngxson requested a review from CISC as a code owner February 16, 2026 23:21
n_kv_head = self.hparams["num_key_value_heads"]
n_embd = self.hparams["hidden_size"]
head_dim = n_embd // n_head
head_dim = self.hparams["head_dim"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, seems like the existing GGUF is already broken out-of-the-box since #18042 , mostly due to this wrong head_dim calculation. Need to do more testing...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, this PR fixes the quality problem from the original PR #18042

@github-actions github-actions bot added model Model specific examples python python script changes labels Feb 17, 2026
@omkarsharma9817293193-creator

This comment was marked as spam.

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
@ngxson ngxson merged commit eeef3cf into ggml-org:master Feb 18, 2026
77 of 79 checks passed
liparetejas pushed a commit to liparetejas/llama.cpp that referenced this pull request Feb 23, 2026
* model: support GLM-OCR

* Update convert_hf_to_gguf.py

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

---------

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
bartowski1182 pushed a commit to bartowski1182/llama.cpp that referenced this pull request Mar 2, 2026
* model: support GLM-OCR

* Update convert_hf_to_gguf.py

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

---------

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
ArberSephirotheca pushed a commit to ArberSephirotheca/llama.cpp that referenced this pull request Mar 3, 2026
* model: support GLM-OCR

* Update convert_hf_to_gguf.py

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

---------

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples model Model specific python python script changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add Support for GLM-OCR Model

3 participants