From b124b59ce48e4d53abd14d1fd08979350fc27358 Mon Sep 17 00:00:00 2001 From: Robert Karl Date: Tue, 13 Oct 2026 13:26:18 -0700 Subject: [PATCH] Front end: the vision projector's width is checked against the model's, so Qwen3.6-35B-A3B takes images (CPU encoder) Checked on the GTX 1080 Ti with Q4_K_XL at 262,144 context: six of six facts read from a 1920x1080 screenshot. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr --- README.md | 7 +++++-- frontend/vision.hpp | 12 +++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d10f698..838eec9 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,9 @@ quantizations, with the pack and draft pack made by this repository's own tools | Draft pack `qwen36-mtp-draft/` (`experts.bin`, `dense.bin`, `dense.txt`, `native_experts.txt`, `mtp.json`, `draft_vocab.bin`), cut from the -MTP file's draft block; serves both quantizations | 0.5 GB | per file in UPSTREAM.md | No other Qwen3.6 file is accepted: the IQ4_XS-MTP file's draft block (Q3_K experts) and the 27B dense model -are refused by name. The vision encoder (`mmproj`) is not wired for this model yet. +are refused by name. Images work with `--mmproj` and the model's own encoder (`mmproj-F16.gguf` from the -MTP repository, +899 MB); the encoder runs on the CPU, so the first use of a full-screen image costs 24 s on an i9-9900K and +about 70 s on a Ryzen 7 1700, and repeats are served from a cache. #### Sizing @@ -235,7 +237,8 @@ builds differ in compile flags and in how the n-gram table is held in RAM, and e because the model's template re-renders an earlier reply without its reasoning. Tool loops reuse nearly everything (1,867 of 1,948 tokens in a pi session); `chat_template_kwargs.preserve_thinking` with `reasoning_content` sent back reuses the reply too, at the cost of keeping old reasoning in context. - A tool call arrives as one delta, not streamed. Images are not wired; the RTX 50 and Volta builds have not + A tool call arrives as one delta, not streamed. Images are checked on one screenshot only, and not + against llama.cpp; the RTX 50 and Volta builds have not run on a card. Prompt processing is slower than llama.cpp with every expert on the card, at 6 GB, and for long prompts on a GTX 1080 Ti. diff --git a/frontend/vision.hpp b/frontend/vision.hpp index 146cf85..79dde07 100644 --- a/frontend/vision.hpp +++ b/frontend/vision.hpp @@ -74,7 +74,17 @@ public: auto key = gg ? gguf_find_key(gg.get(), "clip.vision.projection_dim") : -1; if (key < 0) throw std::runtime_error("vision encoder has no projection_dim"); width_ = (int) gguf_get_val_u32(gg.get(), key); - if (width_ != 2560) throw std::runtime_error("vision projector does not match Flash-Next's 2560 embedding width"); + // the projector must produce rows of the model's own width (2560 for Flash-Next, 2048 for Qwen3.6-35B-A3B); + // the tokenizer-only model the front end holds has no hparams, so the width is read from its metadata + char arch[64] = {0}, val[32] = {0}; + int want = 0; + if (llama_model_meta_val_str(model, "general.architecture", arch, sizeof arch) > 0 && + llama_model_meta_val_str(model, (std::string(arch) + ".embedding_length").c_str(), val, sizeof val) > 0) + want = std::atoi(val); + if (want <= 0) throw std::runtime_error("cannot read the model's embedding width"); + if (width_ != want) + throw std::runtime_error("vision projector width " + std::to_string(width_) + + " does not match the model's embedding width " + std::to_string(want)); max_tokens_ = max_tokens; auto cp = mtmd_context_params_default(); cp.use_gpu = false; cp.print_timings = false; cp.warmup = false;