]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama: Restore quantization of mmprojs (#26818)
authorPedro Cuenca <redacted>
Mon, 10 Aug 2026 09:58:32 +0000 (11:58 +0200)
committerGitHub <redacted>
Mon, 10 Aug 2026 09:58:32 +0000 (11:58 +0200)
* Restore quantization of mmprojs

This was lost in the refactor undertaken in #22004.

* add noreturn

---------

Co-authored-by: Xuan Son Nguyen <redacted>
src/llama-model.cpp
src/models/clip.cpp [new file with mode: 0644]
src/models/models.h

index 9316636d66770818a74034dbbb8b2a45ad27367b..2e60c131d46f2244df199977efb099d73c6adb1a 100644 (file)
@@ -40,6 +40,8 @@
 
 static llama_model * llama_model_mapping(llm_arch arch, const llama_model_params & params) {
     switch (arch) {
+        case LLM_ARCH_CLIP:
+            return new llama_model_clip(params);
         case LLM_ARCH_LLAMA:
             return new llama_model_llama(params);
         case LLM_ARCH_LLAMA4:
diff --git a/src/models/clip.cpp b/src/models/clip.cpp
new file mode 100644 (file)
index 0000000..537766a
--- /dev/null
@@ -0,0 +1,18 @@
+#include "models.h"
+
+// Stub to allow llama-quantize to open mmproj GGUFs
+
+[[noreturn]]
+void llama_model_clip::load_arch_hparams(llama_model_loader &) {
+    GGML_ABORT("CLIP is a quant-only stub; load_arch_hparams should not be called");
+}
+
+[[noreturn]]
+void llama_model_clip::load_arch_tensors(llama_model_loader &) {
+    GGML_ABORT("CLIP is a quant-only stub; load_arch_tensors should not be called");
+}
+
+[[noreturn]]
+std::unique_ptr<llm_graph_context> llama_model_clip::build_arch_graph(const llm_graph_params &) const {
+    GGML_ABORT("CLIP has no inference graph via llama_model dispatch; runtime lives in tools/mtmd/clip.cpp");
+}
index 12412ef53489715fe42f11eb1a9689f4da50bd86..7c813be6e664ab4007e54504e23abe4fa532875c 100644 (file)
@@ -386,6 +386,22 @@ struct llama_model_bloom : public llama_model_base {
 };
 
 
+// Quant-only stub for mmproj GGUFs
+// none of these are ever called, they only exist to satisfy the llama_model_base interface
+struct llama_model_clip : public llama_model_base {
+    llama_model_clip(const struct llama_model_params & params) : llama_model_base(params) {}
+
+    [[noreturn]]
+    void load_arch_hparams(llama_model_loader & ml) override;
+
+    [[noreturn]]
+    void load_arch_tensors(llama_model_loader & ml) override;
+
+    [[noreturn]]
+    std::unique_ptr<llm_graph_context> build_arch_graph(const llm_graph_params & params) const override;
+};
+
+
 struct llama_model_mpt : public llama_model_base {
     llama_model_mpt(const struct llama_model_params & params) : llama_model_base(params) {}
     void load_arch_hparams(llama_model_loader & ml) override;