Skip to content

feat(models): port GLM-OCR (ViT + GLM-4 text OCR) #547

Closed

Description

@inureyes

Summary

Add GLM-OCR support to mlxcel. GLM-OCR is a compact document-OCR VLM: a 24-block ViT vision tower (packed cu_seqlens attention, 2D rotary, Conv2d spatial downsample, SwiGLU patch merger) feeding a 16-layer GLM-4-style text decoder driven by full-width even/odd MRoPE. Checkpoints ship config.json with model_type: "glm_ocr" (architecture GlmOcrForConditionalGeneration); mlxcel has no arm for it in src/models/detection.rs, so loading fails with "Unsupported model type".

The model is a close sibling of the in-tree GLM-4V stack (src/models/glm4v.rs, src/vision/glm4v.rs, src/vision/encoders/glm4v.rs), so most of the port is a variant of existing code rather than new machinery. A real checkpoint is available as zai-org/GLM-OCR (bf16, single model.safetensors, 526 tensors); all config values, weight keys, and shapes below were verified against it.

Current state in mlxcel

grep -r glm_ocr src/ returns nothing. Relevant existing pieces (all paths verified):

  • src/models/glm4v.rs: Glm4vTextModel + Glm4vTextConfig + Glm4vMRoPE (chunked axis selector, EvenOdd/HalfSplit pairing) + per-sequence MRoPE state via crate::models::qwen_mrope_state::MRopeState. The decoder layer (4 RMSNorms, fused gate_up_proj) is exactly what GLM-OCR needs.
  • src/vision/encoders/glm4v.rs: Glm4vVisionEncoder with PatchEmbed (Conv3d as linear), VisionRotaryEmbedding + host_pos_ids + rotary_table, packed-attention VisionBlock, Downsample (Conv2d as linear), PatchMerger. GLM-OCR reuses most of this but is not identical (see Architecture).
  • src/vision/glm4v.rs: Glm4vModel VLM wrapper with get_input_embeddings + compute_rope_index + the LanguageModel impl.
  • src/vision/processors/qwen2_vl.rs: Qwen2VLProcessor (smart resize to multiples of 28, CLIP mean/std, patch flattening). GLM-OCR uses the same scheme with different pixel bounds.
  • src/loading/vlm_qwen.rs: load_glm4v, remap_glm4v_weights, extract_glm4v_mrope_section (already checks both rope_scaling and rope_parameters), extract_glm4v_eos_token_ids; shared helpers qwen_vl_processor / qwen_vl_token_ids live in src/loading/vlm.rs.
  • src/multimodal/qwen_vl.rs: QwenVlRuntime trait, impl_qwen_vl_runtime_loop_dispatch! macro, insert_qwen_vl_image_tokens placeholder expansion.
  • Registration surfaces: src/models/detection.rs, src/models/mod.rs (enum, ALL_MODEL_TYPES, display names, all_variants! test list), src/loaded_model.rs (enum + dispatch macro), src/loaded_model_capabilities.rs (VlmRuntimeRef::Qwen), src/loading/mod.rs, src/model_metadata.rs.
  • OCR precedent: PaddleOCR-VL (src/vision/paddleocr_vl.rs, src/vision/encoders/paddleocr_vl.rs, src/vision/connectors/paddleocr_vl.rs, src/vision/processors/paddleocr_vl.rs, src/loading/vlm_paddleocr.rs, tests/paddleocr_vl_parity.rs). Useful mainly for its dual-layout conv-weight detection and its test structure; architecturally GLM-OCR is much closer to GLM-4V.

Architecture

config.json (exact keys and values from the reference checkpoint)

Top level: model_type: "glm_ocr", image_token_id: 59280, video_token_id: 59281, image_start_token_id: 59256, image_end_token_id: 59257, video_start_token_id: 59258, video_end_token_id: 59259.

text_config (model_type: "glm_ocr_text"):

key value
vocab_size 59392
hidden_size 1536
intermediate_size 4608
num_hidden_layers 16
num_attention_heads 16
num_key_value_heads 8
head_dim 128 (explicit: 16 x 128 = 2048 != hidden_size)
attention_bias false
rms_norm_eps 1e-05
max_position_embeddings 131072
eos_token_id [59246, 59253]
pad_token_id 59246
tie_word_embeddings false
num_nextn_predict_layers 1
rope_parameters {"rope_type": "default", "mrope_section": [16, 24, 24], "partial_rotary_factor": 1.0, "rope_theta": 10000}

Config trap: the rope block is nested under rope_parameters, not rope_scaling, and there is no top-level rope_theta or partial_rotary_factor. Glm4vTextConfig today deserializes rope_scaling.mrope_section and top-level rope_theta/partial_rotary_factor with defaults 0.5 and [8, 12, 12]. Feeding this config through unchanged silently produces half-width rotary with wrong sections, which decodes garbage. The loader (or a serde alias plus extended RopeScaling fields) must lift rope_parameters.partial_rotary_factor = 1.0, rope_parameters.mrope_section = [16, 24, 24], and rope_parameters.rope_theta = 10000.

vision_config (model_type: "glm_ocr_vision"): depth: 24, hidden_size: 1024, num_heads: 16, intermediate_size: 4096, attention_bias: true, image_size: 336, patch_size: 14, out_hidden_size: 1536, rms_norm_eps: 1e-05, spatial_merge_size: 2, temporal_patch_size: 2, in_channels implicitly 3.

preprocessor_config.json: size: {shortest_edge: 12544, longest_edge: 9633792} (min/max pixels), patch_size: 14, temporal_patch_size: 2, merge_size: 2, image_mean: [0.48145466, 0.4578275, 0.40821073], image_std: [0.26862954, 0.26130258, 0.27577711], do_rescale: true.

Vision tower (24 blocks, hidden 1024, 16 heads, head_dim 64)

Patch embedding: a 3D convolution with kernel == stride == (kT=2, kH=14, kW=14), 3 -> 1024 channels, with bias. Because kernel == stride it degenerates to a linear layer over each flattened patch of 3 x 2 x 14 x 14 = 1176 features. The in-tree PatchEmbed in src/vision/encoders/glm4v.rs already evaluates it as a matmul; only the weight permutation differs by source layout (see Weight loading).

Per-block, operating on packed tokens (total_patches, 1024) with no batch axis:

  1. norm1: RMSNorm(1024, eps 1e-5). The in-tree glm4v VisionBlock hardcodes eps 1e-6; GLM-OCR must use the config value 1e-5.
  2. Attention: fused qkv linear 1024 -> 3072 with bias, output reshaped to (total, 3, n_heads=16, head_dim=64) and split along axis 1 into q, k, v each (total, 16, 64).
    • q_norm / k_norm (new vs the in-tree glm4v block): per-head RMSNorm over the last axis (head_dim 64, eps 1e-5, weight shape (64,)) applied to q and k before rotary.
    • 2D rotary: for token at patch grid position (h_pos, w_pos), the angle vector has 32 entries: theta = [h_pos * f_0..f_15, w_pos * f_0..f_15] with f_i = 10000^(-i/16). cos/sin are formed by duplicating theta along the last axis to 64 entries (concat of theta with itself at axis -1), then rotate-half application over the full 64 dims: x_rot = x * cos + rotate_half(x) * sin, where rotate_half splits the 64-dim last axis at index 32 into (x1, x2) and returns concat(-x2, x1, axis=-1). This matches the in-tree VisionRotaryEmbedding + rotary_table + apply_rotary_pos_emb_vision scheme in src/vision/encoders/glm4v.rs, reusable as-is.
    • Packed attention: q/k/v transposed to (1, n_heads, total, head_dim); scaled dot-product attention (scale 64^-0.5, no mask) is run per image segment by slicing axis 2 at the cu_seqlens boundaries (one segment per frame, h * w patches each). Output transposed back and reshaped to (total, 1024), then proj linear 1024 -> 1024 with bias.
  3. Residual add, norm2 RMSNorm(1024, eps 1e-5), MLP: SwiGLU with gate_proj/up_proj 1024 -> 4096 and down_proj 4096 -> 1024, all with bias (glm4v vision MLP is bias-free), down(silu(gate(x)) * up(x)), residual add.

Absent vs the in-tree glm4v encoder (the checkpoint has no such tensors, do not port them): the learned embeddings.position_embedding with bilinear/grid resampling, and post_conv_layernorm. Patch embeddings go straight into block 0; position information comes only from the 2D rotary.

After the blocks:

  1. post_layernorm: RMSNorm(1024, eps 1e-5) on (total, 1024).
  2. Downsample: reshape (total, 1024) -> (total/4, 2, 2, 1024) grouping each spatial-merge window, then a Conv2d with kernel == stride == 2, 1024 -> 1536 channels, with bias, i.e. a linear over each flattened (2, 2, 1024) block -> (total/4, 1536). The block flatten order is (kH, kW, channels); the weight must be flattened in the same order (see Weight loading).
  3. Merger (merger.*): proj 1536 -> 1536 (no bias) -> post_projection_norm LayerNorm(1536, weight + bias, eps 1e-5) -> GELU -> SwiGLU with gate_proj/up_proj 1536 -> 4608 and down_proj 4608 -> 1536 (all no bias). Output (merged_tokens, 1536) lands directly in the text hidden size; there is no separate connector module (same as glm4v, the projection lives inside the tower).

Merged token count per image: t * (h/2) * (w/2) with grid dims in patch units and t = 1 for still images.

Text decoder (16 layers, GLM-4 style)

Same block structure as Glm4vTextModel in src/models/glm4v.rs (reusable as-is):

  • Four RMSNorms per layer (input_layernorm, post_self_attn_layernorm applied to the attention output before the residual add, post_attention_layernorm before the MLP, post_mlp_layernorm applied to the MLP output before the residual add), all (1536,), eps 1e-5.
  • Attention with decoupled head width: q_proj 1536 -> 2048 (16 heads x 128), k_proj/v_proj 1536 -> 1024 (8 KV heads x 128, GQA 2:1), o_proj 2048 -> 1536, no biases, scale 128^-0.5. Shapes per step: input (batch, seq, 1536), q reshaped to (batch, seq, 16, 128) then transposed to (batch, 16, seq, 128) (axes [0, 2, 1, 3]), causal mask, KV cache as usual.
  • MLP: fused gate_up_proj 1536 -> 9216, split at axis -1 into gate and up (4608 each), down_proj(silu(gate) * up) 4608 -> 1536.
  • Final norm RMSNorm then untied lm_head 1536 -> 59392.

MRoPE (the one text-side formula difference from glm4v): rotary covers the full head_dim 128 (partial_rotary_factor 1.0, so rope_dims = 128, 64 frequency pairs; glm4v rotates only 64 dims). mrope_section = [16, 24, 24] sums to 64: pair index j takes the Temporal position axis for j < 16, Height for 16 <= j < 40, Width for 40 <= j < 64. Angle theta_j = pos[axis(j)] * 10000^(-j/64); pairing is even/odd (GPT-J style): dims (2j, 2j+1) rotate together, cos/sin interleave-repeated. This is exactly Glm4vMRoPE::new(10000.0, 128, &[16, 24, 24], Glm4vRopePairing::EvenOdd); no new rotary code is needed, only correct config plumbing.

3D position ids for mixed text+image sequences (shape (3, batch, seq), axes T/H/W):

  • Text runs: all three axes share the same scalar position, incrementing by 1 per token.
  • An image run of llm_h * llm_w merged tokens (llm_h = h/2, llm_w = w/2): T is constant at the run's start position; H is start + row where row runs 0..llm_h, each value repeated llm_w times; W is start + col tiled llm_h times. After the image, the text position advances by max(llm_h, llm_w).

For still images (t = 1) this is numerically identical to Glm4vModel::compute_rope_index in src/vision/glm4v.rs, which can be reused unchanged. Video position math differs (per-frame grouping with temporal merging) and is out of scope.

Processor and placeholder expansion

  • Smart resize: round height and width to the nearest multiple of factor = patch_size * merge_size = 28, then rescale by sqrt so that t_bar * h_bar * w_bar stays within [12544, 9633792] pixels (note the temporal factor participates in the bound). Grid per image: (t=1, h = resized_h/14, w = resized_w/14) in patch units.
  • Normalize: (pixel/255 - mean) / std with the CLIP values above.
  • Native pixel_values layout in the checkpoint's processing convention: (t * h * w, 1176) where each row flattens one patch in (channels, temporal, patch_h, patch_w) order and rows are ordered merge-window-major: (t, h/2, w/2, 2, 2), i.e. the four patches of each 2x2 merge window are consecutive. A still image is duplicated to temporal_patch_size = 2 identical frames.
  • The in-tree Qwen2VLProcessor emits (total * temporal_patch_size, 588) rows (per-row flatten (channels, patch_h, patch_w), two consecutive temporal rows per patch) and the glm4v-style PatchEmbed regroups row pairs into 1176-feature patches; that pairing is fine. Consistency requirement: whatever row order the processor emits, the vision rotary position ids (host_pos_ids), the cu_seqlens segmentation, the downsample's (total/4, 2, 2, 1024) window grouping, and the text-side merged-token order must all assume the same order. host_pos_ids and the downsample in src/vision/encoders/glm4v.rs assume merge-window order while Qwen2VLProcessor::preprocess_with_grid emits plain raster order (row-major over (py, px)); verify and fix this alignment for the GLM-OCR path during parity testing, using a spatially asymmetric test image (for OCR, spatial scrambling directly destroys output quality).
  • Reuse Qwen2VLProcessor with min_pixels = 12544 and max_pixels = 9633792 (the struct fields are public; the defaults 3136 / 12845056 do not match). The CLIP mean/std defaults already match.
  • Placeholder expansion: the chat template renders exactly one <|image|> (id 59280) per image, framed by <|begin_of_image|> (59256) / <|end_of_image|> (59257). The runtime must expand each single placeholder to t * (h/2) * (w/2) copies; insert_qwen_vl_image_tokens in src/multimodal/qwen_vl.rs (Expand case) already does this. Note the config key naming: GLM-OCR ships image_start_token_id, not vision_start_token_id, so qwen_vl_token_ids in src/loading/vlm.rs will not pick it up without a tweak; pass 59256 as the default or read the GLM-OCR key.

Prompt format

Chat template (ships as chat_template.jinja in the checkpoint): [gMASK]<sop> prefix, roles <|system|> / <|user|> / <|assistant|>, image content rendered as <|begin_of_image|><|image|><|end_of_image|>. The generation prompt ends with <|assistant|>, and the model emits a \n<think>...</think>\n block before the answer. EOS ids: 59246 (<|endoftext|>) and 59253.

Canonical OCR task prompts (user text placed after the image block):

  • Text Recognition: for plain text extraction
  • Formula Recognition: for formulas
  • Table Recognition: for tables
  • structured extraction: 请按下列JSON格式输出图中信息: followed by a JSON schema skeleton

Implementation plan

Per-file, with reuse decisions:

  1. src/models/detection.rs: add "glm_ocr" => Ok(ModelType::GlmOcr) next to the "glm4v" arm. New arm.
  2. src/models/mod.rs: add ModelType::GlmOcr to the enum (near Glm4v), ALL_MODEL_TYPES, the display-name match (("GLM-OCR", "GLM VLM")), and the all_variants! list. New registrations.
  3. Text backbone: reuse Glm4vTextModel unchanged. The layer structure, weight-key layout (model.layers.N.*, model.embed_tokens, model.norm, lm_head), and Glm4vMRoPE all match. What must change is config plumbing in src/models/glm4v.rs: support rope_parameters (serde alias for rope_scaling plus optional partial_rotary_factor / rope_theta fields inside RopeScaling, or loader-side normalization) so rope_dims = 128 and mrope_section = [16, 24, 24] come out of the checkpoint config, and thread the GLM-OCR EOS defaults [59246, 59253]. attention_bias needs no code path change (UnifiedLinear auto-loads .bias keys only when present, and GLM-OCR text has none).
  4. src/vision/encoders/glm_ocr.rs: new file, a variant of src/vision/encoders/glm4v.rs. Reuse (copy or factor out): PatchEmbed, VisionRotaryEmbedding + host_pos_ids + rotary_table, packed-attention segment loop, Downsample, PatchMerger, compute_cu_seqlens. Changes: drop VisionEmbeddings and post_conv_layernorm; add per-head q_norm/k_norm RMSNorm(64) in the attention before rotary; take block-norm eps from rms_norm_eps (1e-5) instead of the hardcoded 1e-6; add the conv-weight layout detection described below. Biases on qkv/proj/MLP load automatically through UnifiedLinear.
  5. src/vision/glm_ocr.rs: new file modeled on src/vision/glm4v.rs (Glm4vModel). Same get_input_embeddings flow (embed tokens, run tower, merge::merge_llava on image_token_id 59280, compute 3D position ids, set_mrope_state); compute_rope_index can be shared with glm4v since the image-only math is identical. Register pub use in src/vision/mod.rs.
  6. Connector: none needed. The downsample + merger live inside the encoder, as with glm4v (no src/vision/connectors/ entry).
  7. Processor: reuse src/vision/processors/qwen2_vl.rs, constructed with min_pixels = 12544, max_pixels = 9633792 (read preprocessor_config.json if present, else these defaults).
  8. Loader: add load_glm_ocr in src/loading/vlm_qwen.rs beside load_glm4v (or a small src/loading/vlm_glm_ocr.rs wired into src/loading/vlm.rs and src/loading/mod.rs). Reuse remap_glm4v_weights (identical prefixes), add the MTP-layer drop (below), lift rope_parameters, build the processor with GLM-OCR pixel bounds, and take token ids image_token_id = 59280, video_token_id = 59281, start token 59256 (key image_start_token_id). Dispatch from src/loading/mod.rs (ModelType::GlmOcr => Some(load_glm_ocr(model_path)?)).
  9. Runtime integration: add LoadedModel::GlmOcr(vision::GlmOcrModel) in src/loaded_model.rs (enum + dispatch macro arm), Self::GlmOcr(model) => Some(VlmRuntimeRef::Qwen(model)) in src/loaded_model_capabilities.rs, and impl_qwen_vl_runtime_loop_dispatch!(vision::GlmOcrModel); in src/multimodal/qwen_vl.rs. This is what makes the model actually servable through mlxcel-server and the CLI; the port is not done until this wiring exists.
  10. src/model_metadata.rs: add a GlmOcr row (kind: Vlm, directory: Vlm, adapter unsupported message), mirroring the Glm4v row.
  11. src/distributed/tensor_parallel/inference.rs: either map ModelType::GlmOcr alongside Glm4-family entries or leave it explicitly unsupported for TP; do not let the match fall through silently.
  12. docs/supported-models.md: add a GLM-OCR entry next to the GLM-4V/PaddleOCR-VL lines describing the tower (3D patch embed, q/k-normed packed attention, Conv2d downsample, SwiGLU merger) and the GLM-4 text backbone with full-width even/odd MRoPE.
  13. Tests: co-located unit tests plus tests/glm_ocr_parity.rs (see Validation).

Weight loading and sanitize

Raw checkpoint key prefixes and the remap (identical to remap_glm4v_weights in src/loading/vlm_qwen.rs, reuse it):

checkpoint key mlxcel key
model.visual.* vision_tower.*
model.language_model.* model.*
lm_head.weight lm_head.weight (unchanged)

MTP layer drop (new sanitize step): the checkpoint contains a multi-token-prediction block at model.language_model.layers.16.* (num_nextn_predict_layers: 1; keys include eh_proj.weight (1536, 3072), embed_tokens.weight, enorm.weight, hnorm.weight, shared_head.head.weight (59392, 1536), shared_head.norm.weight, plus a full decoder layer). num_hidden_layers is 16, so inference uses layers 0..15 only; drop every key whose layer index is >= num_hidden_layers before Glm4vTextModel::from_weights (which loads strictly model.layers.0..15 and would otherwise just leak the tensors, and any generic "count the layers" logic would miscount).

Layout permutations. Checkpoints store linear weights as (out_features, in_features), applied as x @ W^T; no permutation needed. Convolutions are the exception; the checkpoint stores channels-second layouts while the in-tree matmul evaluation expects specific flatten orders:

  • vision_tower.patch_embed.proj.weight: stored (1024, 3, 2, 14, 14) = (out, in_channels, kT, kH, kW). The matmul weight must be (1024, 1176) flattened in the same order as the per-patch input flatten (temporal, channels, patch_h, patch_w), so permute axes [0, 2, 1, 3, 4] -> (1024, 2, 3, 14, 14) = (out, kT, in, kH, kW), then reshape to (1024, 1176). The existing glm4v PatchEmbed assumes the pre-permuted channels-last layout (out, kT, kH, kW, in) = (1024, 2, 14, 14, 3) and permutes [0, 1, 4, 2, 3]; some published exports ship that layout. Detect which one arrived by shape (axis 1 == 3 and axis 2 == 2 means channels-second; axis 4 == 3 means channels-last) and permute accordingly, following the dual-layout detection precedent in src/vision/encoders/paddleocr_vl.rs (PatchEmbed::from_weights).
  • vision_tower.downsample.weight: stored (1536, 1024, 2, 2) = (out, in_channels, kH, kW). The downsample input is each merge window flattened from (2, 2, 1024) in (kH, kW, channels) order, so permute axes [0, 2, 3, 1] -> (1536, 2, 2, 1024), then reshape to (1536, 4096). The in-tree glm4v Downsample::from_weights reshapes without permuting (it assumes the channels-last export layout (1536, 2, 2, 1024)); loading the raw checkpoint through that code would be silently wrong, so the GLM-OCR downsample needs the same shape-based detection (axis 1 == 1024 means channels-second, axis 3 == 1024 means channels-last; the two are unambiguous because 1024 != 2).
  • vision_tower.patch_embed.proj.bias (1024,), vision_tower.downsample.bias (1536,) and all other biases are 1-D (out_features,), no permutation.

Key inventory to load (shapes as stored): text per layer self_attn.q_proj.weight (2048, 1536), k_proj (1024, 1536), v_proj (1024, 1536), o_proj (1536, 2048), mlp.gate_up_proj.weight (9216, 1536), mlp.down_proj.weight (1536, 4608), four norm weights (1536,); model.embed_tokens.weight (59392, 1536), model.norm.weight (1536,), lm_head.weight (59392, 1536) (untied; sanitize_tied_embeddings in src/models/sanitize.rs is a no-op because tie_word_embeddings is explicitly false). Vision per block: attn.qkv.weight (3072, 1024) + bias (3072,), attn.proj.weight (1024, 1024) + bias, attn.q_norm.weight (64,), attn.k_norm.weight (64,), mlp.gate_proj.weight (4096, 1024) + bias, mlp.up_proj same, mlp.down_proj.weight (1024, 4096) + bias, norm1.weight (1024,), norm2.weight (1024,); plus post_layernorm.weight (1024,), merger.proj.weight (1536, 1536) (no bias), merger.post_projection_norm.weight + .bias (1536,), merger.gate_proj.weight (4608, 1536), merger.up_proj.weight (4608, 1536), merger.down_proj.weight (1536, 4608) (all no bias). There is no position_embedding and no post_conv_layernorm tensor; treat their presence as an error rather than loading glm4v modules by accident.

Validation and acceptance criteria

  1. Co-located unit tests (in the new model/encoder/loader files, plus src/models/glm4v_tests.rs-style coverage where config code is shared):
    • rope_parameters lifting: parsed config yields rope_dims = 128, mrope_section = [16, 24, 24], rope_theta = 10000; a glm4v-style config still yields the old values.
    • MRoPE golden values: a hand-computed cos/sin for a small position tensor at full-width even/odd pairing.
    • Conv layout detection: both (out, in, kT, kH, kW) / (out, kT, kH, kW, in) patch-embed layouts and both downsample layouts produce identical matmul weights.
    • MTP drop: synthetic weight map containing model.layers.16.* keys loads a 16-layer model and ignores the extras.
    • Processor: smart-resize bounds honor min 12544 / max 9633792; placeholder expansion count equals h*w/4 per image.
  2. Synthetic parity test tests/glm_ocr_parity.rs, modeled on tests/glm4v_parity.rs: config-detection tests that run in CI without a checkpoint (model_type: "glm_ocr" maps to the new variant), plus checkpoint-gated forward tests (text-only decode and an image forward with shape/finiteness checks and a deterministic golden comparison) that skip cleanly when the model directory is absent.
  3. Real-checkpoint smoke test: load zai-org/GLM-OCR (bf16, single-file safetensors) and generate through mlxcel's actual runtime (server or CLI, the same path users hit), running Text Recognition: on a document image and checking that the recognized text matches the image content; also exercise Table Recognition: once. Include the patch-order consistency check with a spatially asymmetric image (text confined to one corner must be read correctly).

Known failure mode to design for: synthetic parity can pass while a real checkpoint breaks on weight-key layout (the MTP layer, conv layouts), config defaults (the rope_parameters nesting, mrope_section, partial_rotary_factor, EOS ids), and tokenizer/chat-template details ([gMASK]<sop>, <think> block, <|image|> expansion). Real-checkpoint load + generate is therefore the completion bar, and completion requires the model to be reachable through the working runtime (detection -> loader -> LoadedModel -> QwenVlRuntime -> server/CLI), not standalone modules that compile but are never dispatched.

Out of scope

  • Video inputs (video_grid_thw, per-frame temporal position grouping); still-image OCR only.
  • The MTP layer as a speculative-decoding feature (it is dropped at load, not executed).
  • LoRA adapters and tensor-parallel sharding (register the metadata rows as unsupported, matching GLM-4V).
  • Quantized exports: nothing extra should be needed (UnifiedLinear auto-detects .scales/.biases), but validating a quantized variant is follow-up work, not part of this issue.

Activity

  1. added
    type:enhancement
    status:ready
    priority:low
    area:models
    on Jul 1, 2026
  2. added a commit that references this issue on Jul 3, 2026
    68c659b
  3. self-assigned this
    on Jul 4, 2026
  4. added
    status:done
    and removed
    status:ready
    on Sep 6, 2026
  5. added a commit that references this issue on Oct 27, 2026
    7bd5768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:modelspriority:lowstatus:donetype:enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions