From 3cb8e0e5d13abbed7181975df20b633df2b42777 Mon Sep 17 00:00:00 2001 From: CharlieX Date: Mon, 15 Jun 2026 13:40:44 -0700 Subject: [PATCH] fix(vlm): expose _tokenizer on VLMTokenizerWrapper for guided decoding VLMTokenizerWrapper.__init__ sets self.tokenizer but OutlinesLogitsProcessor reads tokenizer._tokenizer (outlines_logits_processor.py:48,58). Any json_schema / guided-decoding request against a VLM therefore raises AttributeError: 'VLMTokenizerWrapper' object has no attribute '_tokenizer'. Alias self._tokenizer = self.tokenizer in __init__ so the Outlines path works with VLM models. --- src/mlx_omni_server/chat/mlx/model_types.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mlx_omni_server/chat/mlx/model_types.py b/src/mlx_omni_server/chat/mlx/model_types.py index 4660772..06e0a51 100644 --- a/src/mlx_omni_server/chat/mlx/model_types.py +++ b/src/mlx_omni_server/chat/mlx/model_types.py @@ -140,6 +140,12 @@ def __init__(self, processor): else: self.tokenizer = processor + # OutlinesLogitsProcessor accesses tokenizer._tokenizer + # (outlines_logits_processor.py), so expose it here too — + # otherwise json_schema/guided decoding with a VLM raises + # AttributeError: 'VLMTokenizerWrapper' has no '_tokenizer'. + self._tokenizer = self.tokenizer + # Load config from model path for apply_chat_template # We'll get it from the model's config attribute if available self.config = {"model_type": "gemma4"} # Default