MLXLMTypeAdapter.format_output_type (line 97) uses if not output_type instead of if output_type is None:
# mlxlm.py:97
def format_output_type(self, output_type=None):
if not output_type: # wrong: discards any processor where bool(processor) is False
return None
return [output_type]
If a logits processor subclass defines __bool__ returning False, the processor is silently discarded and generation proceeds unconstrained — no error raised. Every other model file uses the correct pattern (transformers.py, vllm.py, llamacpp.py, etc.).
Minimum example:
class FalsyProcessor:
def __bool__(self): return False
def format_output_type_buggy(output_type=None):
if not output_type: # exact mlxlm.py code
return None
return [output_type]
p = FalsyProcessor()
print(p is None) # False
print(format_output_type_buggy(p)) # None — processor silently dropped
Fix: replace if not output_type: with if output_type is None:, consistent with every other model backend.
MLXLMTypeAdapter.format_output_type(line 97) usesif not output_typeinstead ofif output_type is None:If a logits processor subclass defines
__bool__returningFalse, the processor is silently discarded and generation proceeds unconstrained — no error raised. Every other model file uses the correct pattern (transformers.py,vllm.py,llamacpp.py, etc.).Minimum example:
Fix: replace
if not output_type:withif output_type is None:, consistent with every other model backend.