llama.cpp b11774 修复 LFM2 图像切片与布局对齐
原标题:b11774
AI 摘要
llama.cpp 发布 b11774 版本,修复了 mtmd 模块中 LFM2 系列视觉语言模型(LFM2-VL、LFM2.5-VL、d1-3B)的图像预处理逻辑。改动使图像切片改为直接拉伸到网格而非保持宽高比补黑边,并将 smart_resize 的舍入与网格宽高比计算改为与 Python 一致的 double 精度,从而在 [1,4096]^2 范围内所有尺寸上与 transformers 实现完全对齐。该修复由 Hugging Face 的 Xuan Son Nguyen 参与贡献,提升了本地推理多模态模型时的预处理一致性。
正文节选
<details open> mtmd : lfm2 tiles and layout match transformers (#30261) * mtmd : lfm2 tiles stretch the image to the grid Lfm2VlImageProcessor.crop_image_to_patches resizes the image straight to (512 * rows, 512 * cols) before it cuts the tiles. llama.cpp kept the aspect ratio and added black bars for LFM2 (only d1-omni stretched), so the tiles of d1-3B and every LFM2-VL / LFM2.5-VL model differed from transformers unless the image had the aspect ratio of the grid. With PAD_NONE the tiles are