YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
LFM2-VL-1.6B-bf16 โ Fixed preprocessor_config.json
This repo contains a corrected preprocessor_config.json for mlx-community/LFM2-VL-1.6B-bf16.
Problem
The mlx-community conversion of LFM2-VL-1.6B has two bugs in preprocessor_config.json:
image_processor_typeis set to"Siglip2ImageProcessor"instead of"Lfm2VlImageProcessorFast"input_data_formatis set to"channels_last"instead ofnull
These cause inference to crash with:
RuntimeError: The size of tensor a (H) must match the size of tensor b (3) at non-singleton dimension 1
The error occurs because input_data_format: "channels_last" tells the image processor the input is already in (H, W, C) format, but torchvision's normalize expects (C, H, W). When set to null, the processor auto-detects the format correctly.
Fix
Compare with the original LiquidAI/LFM2-VL-1.6B preprocessor_config.json:
| Field | mlx-community (broken) | LiquidAI (correct) | This fix |
|---|---|---|---|
image_processor_type |
Siglip2ImageProcessor |
Lfm2VlImageProcessorFast |
Lfm2VlImageProcessorFast |
input_data_format |
"channels_last" |
null |
null |
Usage
To use this fix, either:
- Download this file and place it in your local mlx-community model cache, or
- Apply at runtime after loading:
from mlx_vlm import load model, processor = load("mlx-community/LFM2-VL-1.6B-bf16") processor.image_processor.input_data_format = None
Upstream
This should be fixed in the mlx-community conversion. Filed as a reference for anyone hitting this error.
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support