Instructions to use aidiffuser/GLM-5.2-Vision-tower-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use aidiffuser/GLM-5.2-Vision-tower-MLX with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir GLM-5.2-Vision-tower-MLX aidiffuser/GLM-5.2-Vision-tower-MLX
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
File size: 3,970 Bytes
9961374 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | ---
license: mit
base_model: zai-org/GLM-5.2
tags:
- mlx
- vision
- glm
- moonvit
- exo
library_name: mlx
---
# GLM-5.2-Vision β MoonViT tower + trained projector (MLX)
Add **image input to any MLX quant of GLM-5.2** with a ~1 GB sidecar: the frozen
MoonViT-3d vision tower from Kimi K2.6 plus the trained 49.5M-parameter
PatchMerger projector from
[baseten/GLM-5.2-Vision-NVFP4](https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4)
(Harry Partridge's vision retrofit), repackaged for Apple Silicon / MLX.
The GLM-5.2 text backbone is untouched β text-only behavior stays byte-identical.
## What's in this repo
| File | What it is |
|---|---|
| `glm52_vision.safetensors` (+ index) | MoonViT-3d tower (417M, 27 layers, 1152-dim, bf16, `vision_tower.*`) **and** the trained projector (`mm_projector.pre_norm/linear_1/linear_2`, 1152 β 2Γ2 merge β 4608 β 6144) in one file. Kimi's original 7168-dim projector is removed β the GLM-trained one replaces it. |
| `config.json` | `vision_config` (+ `text_config.hidden_size: 6144`, `media_placeholder_token_id: 154854`) |
| `preprocessor_config.json`, `kimi_k25_*.py`, `media_utils.py` | Baseten's reference image processor (NaViT resize, patch 14, 2Γ2 merge, β€4096 tokens/image) β the exact preprocessing the projector was trained against |
GLM-5.2's stock tokenizer already contains the image tokens
(`<|begin_of_image|>` 154830, `<|image|>` 154854, `<|end_of_image|>` 154831) β
no tokenizer changes needed. Each image expands to its media-token count at the
`<|image|>` position and the projected features are substituted at those
embedding positions. You need a chat template that renders image content parts
into the marker triplet (GLM's stock template does not; Baseten ships one in
their repo).
## Using with [exo](https://github.com/exo-explore/exo)
exo's vision stack loads this repo directly as a `weights_repo`/`processor_repo`.
Model card stanza:
```toml
[vision]
image_token_id = 154854
model_type = "kimi_vl"
weights_repo = "<this repo id>"
processor_repo = "<this repo id>"
```
Point the card's model at a directory containing your GLM-5.2 MLX quant with
Baseten's `chat_template.jinja` and this repo's `config.json` additions
(`vision_config` / `text_config` / `media_placeholder_token_id`). Assembly
scripts (symlink the backbone β no weight duplication):
[`build_glm52_vision_dir.py`](https://github.com/aidiffuser/exo/blob/update-latest/scripts/build_glm52_vision_dir.py)
and
[`build_glm52_vision_tower.py`](https://github.com/aidiffuser/exo/blob/update-latest/scripts/build_glm52_vision_tower.py).
Verified live on a 2-Mac-Studio (M3 Ultra) tensor-parallel cluster over RDMA,
against both `mlx-community/GLM-5.2-DQ4plus-q8` and `mlx-community/GLM-5.2-mxfp4`:
temp-0 deterministic, no cross-image cache bleed, text-only outputs identical
to the plain model.
## What to expect (honest notes)
- Scene understanding, objects, colors, spatial layout and orientation: **good**.
Reads real-world photos (e.g. product packaging labels) usefully.
- Dense/synthetic text OCR and fine-grained counting: **weak** β this is a 50M
projector retrofit at the source's reported ~Haiku-4.5-level MMMU-Pro (55%),
not a natively-trained VLM. A Kimi K2.6 A/B on the same pipeline is clearly
stronger at fine detail.
- The projector was trained against the bf16/NVFP4 backbone; serving quantized
backbones (mxfp4 / DQ4) costs some additional vision quality, never text
quality.
## Provenance & license
MIT, following all parents. Full chain: **Z.ai** (GLM-5.2, MIT) β
**Moonshot AI** (Kimi K2.6 MoonViT tower, Modified MIT) β **Harry Partridge /
Baseten** (projector training + reference processor,
[baseten/GLM-5.2-Vision-NVFP4](https://huggingface.co/baseten/GLM-5.2-Vision-NVFP4),
MIT) β **exolabs** (original K2.6 tower extraction for MLX) β this repackaging
(tensor remap documented in the build script). None of the upstream teams were
involved in this packaging.
|