mlx-vlm MiniCPM-o-4.5 (quantized, 4-bit) fails with corrupted/blank vision output despite matching converter version

#2
by joeljbrave - opened

Trying to run mlx-community/MiniCPM-o-4_5-4bit locally on Apple Silicon (16GB) with mlx-vlm 0.4.0 (matching the version the checkpoint was converted with, per its model card). Text-only generation works cleanly. Image input loads and runs without crashing but produces near-blank/garbage output regardless of the actual image content.

Traced one confirmed bug: mlx_vlm/models/minicpmo/minicpmo.py's get_vision_embedding() infers a compute dtype from self.language_model.model.embed_tokens.weight.dtype — for a quantized model this is uint32 (MLX's packed 4-bit storage format), not a real float type, and casting pixel data to it corrupted input to the vision tower's conv layer (ValueError: [conv] Invalid input array with type uint32).

Patched this locally by using the layer's scales.dtype instead when quantized.

This resolved the crash, but image output is still near-blank/garbage afterward — suggesting at least one more instance of the same class of bug (a quantized layer's raw storage dtype leaking into a float-expecting computation) elsewhere in the vision or resampler path. Has anyone hit this specifically with quantized MiniCPM-o checkpoints, or found the remaining spot(s) where this happens?

Sign up or log in to comment