Repository navigation
mtmd: add minicpmv46 downsample - #25993
Conversation
Signed-off-by: tc-mb <[email protected]>
Signed-off-by: tc-mb <[email protected]>
Signed-off-by: tc-mb <[email protected]>
Signed-off-by: tc-mb <[email protected]>
Signed-off-by: tc-mb <[email protected]>
|
@ggml-gh-bot review |
Automated code reviewI have completed my static review. Here are my findings. Review: PR #25993 - MiniCPM-V 4.6
|
|
@tc-mb ok seems like there is just one blocking change left: the merger tensor is always required, it may break existing ggufs please confirm if this is expected, or is indeed a bug |
minicpm-v4.6 contains two modes, and the down-sampling switch I added at the beginning is for this purpose. Then 16x compression uses vit merger, but 4x compression does not, as you asked here. So do you have any suggestions for this switchable vit?
I will explain the situation and hope to get your suggestions. |
Please correct if I'm wrong, I understand this as follow: 4x model doesn't use Lines 2031 to 2032 in 555881e So this means 4x model will fail to load because it misses these Proposed solution: Conditionally switch the "required" flag based on bool is_merger_required = n_merge == 4;
get_tensor(string_format(TN_VIT_MERGER_LN1, "weight"), is_merger_required); |
|
A better suggestion: model.vit_merger_ln1_w = get_tensor(string_format(TN_VIT_MERGER_LN1, "weight"), false);
bool is_merger_required = n_merge == 4;
if (is_merger_required && !model.vit_merger_ln1_w) {
throw std::runtime_exception("merger tensor is missing");
} |
|
Gentle ping @tc-mb in case you missed the notification. It should be good to merge once you confirm the question above |
OK, I held a meetup event on Sunday, delayed for a few days. I will revise it as soon as possible. |
Signed-off-by: tc-mb <[email protected]>
|
@ngxson ok, I made a skipped revision, which should conform to your suggestion. I hope you can take a look when you have time. |
I have revised it. Please check it again when you have time. |
* add minicpmv46 downsample Signed-off-by: tc-mb <[email protected]> * put downsample mode inside gguf. Signed-off-by: tc-mb <[email protected]> * build mtmd_image_preprocessor_llava_uhd Signed-off-by: tc-mb <[email protected]> * fix code Signed-off-by: tc-mb <[email protected]> * add convert Signed-off-by: tc-mb <[email protected]> * add 4x ignore vit merger Signed-off-by: tc-mb <[email protected]> --------- Signed-off-by: tc-mb <[email protected]>
* add minicpmv46 downsample Signed-off-by: tc-mb <[email protected]> * put downsample mode inside gguf. Signed-off-by: tc-mb <[email protected]> * build mtmd_image_preprocessor_llava_uhd Signed-off-by: tc-mb <[email protected]> * fix code Signed-off-by: tc-mb <[email protected]> * add convert Signed-off-by: tc-mb <[email protected]> * add 4x ignore vit merger Signed-off-by: tc-mb <[email protected]> --------- Signed-off-by: tc-mb <[email protected]>
* add minicpmv46 downsample Signed-off-by: tc-mb <[email protected]> * put downsample mode inside gguf. Signed-off-by: tc-mb <[email protected]> * build mtmd_image_preprocessor_llava_uhd Signed-off-by: tc-mb <[email protected]> * fix code Signed-off-by: tc-mb <[email protected]> * add convert Signed-off-by: tc-mb <[email protected]> * add 4x ignore vit merger Signed-off-by: tc-mb <[email protected]> --------- Signed-off-by: tc-mb <[email protected]>
* add minicpmv46 downsample Signed-off-by: tc-mb <[email protected]> * put downsample mode inside gguf. Signed-off-by: tc-mb <[email protected]> * build mtmd_image_preprocessor_llava_uhd Signed-off-by: tc-mb <[email protected]> * fix code Signed-off-by: tc-mb <[email protected]> * add convert Signed-off-by: tc-mb <[email protected]> * add 4x ignore vit merger Signed-off-by: tc-mb <[email protected]> --------- Signed-off-by: tc-mb <[email protected]>
Sync 1575 upstream commits since fork point 79bba02 (2026-07-16). Highlights brought in from upstream: - MiniCPM-V 4.7 support (ggml-org#29416) and minicpmv46 downsample (ggml-org#25993) - 22 new model architectures (kimi-k3, glm5-next, qwen4exp, qwen3tts, minimax-01/m3, granite-switch, k2-horizon, ...) - mtmd refactors: internal headers, helper split, new vision/audio models - server: MCP support, decision contexts, batch_ext migration - common: chat parsers split into common/parsers/, json split - llama: load_mode AUTO + lazy_mode on-demand tensor loading - ggml-cpu spacemit upstream updates (Q8_0 IME1 ggml-org#28479, Q5_0 dispatch fix) Merge resolutions (keeping our side): - ggml-spacemit standalone backend registration (CMake, ggml-cpu.c) - GGML_BUILD_PROFILE in ggml/src/CMakeLists.txt - SMT media backend: --media-backend/--smt-config-dir args, media chunk wrapper (server_media_chunk), SMT prefill in process_mtmd_chunk, media worker routing for encode, multi-ASR service init - Kaldi fbank + LFR helpers in mtmd-audio - TTS server mode entry in llama-server main - llama-media link and server-media/server-tts sources in server CMake Merge resolutions (taking upstream): - load_mode/lazy_mode evolution (our cherry-picked older revision was superseded by upstream's final AUTO/mmap+mlock/lazy-mode design) - qwen3 pooled-embeddings LM head skip (ggml-org#30445 supersedes our guard) - upstream server_tokens serialize/deserialize, adapted to wrap server_media_chunk (SMT embd chunks throw on serialize for now) - check_no_mtmd removed (upstream removed all call sites) Co-Authored-By: Claude Code <[email protected]>
Overview
This branch adds configurable visual token downsampling for MiniCPM-V 4.6: