llama: Restore quantization of mmprojs (#26818)

* Restore quantization of mmprojs

This was lost in the refactor undertaken in #22004.

* add noreturn

---------

Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
This commit is contained in:
Pedro Cuenca
2026-08-10 11:58:32 +02:00
committed by GitHub
co-authored by Xuan Son Nguyen
parent 2e2d99cfd2
commit 86c298fb8a
3 changed files with 36 additions and 0 deletions
+2
View File
@@ -40,6 +40,8 @@
static llama_model * llama_model_mapping(llm_arch arch, const llama_model_params & params) { static llama_model * llama_model_mapping(llm_arch arch, const llama_model_params & params) {
switch (arch) { switch (arch) {
case LLM_ARCH_CLIP:
return new llama_model_clip(params);
case LLM_ARCH_LLAMA: case LLM_ARCH_LLAMA:
return new llama_model_llama(params); return new llama_model_llama(params);
case LLM_ARCH_LLAMA4: case LLM_ARCH_LLAMA4:
+18
View File
@@ -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");
}
+16
View 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 { struct llama_model_mpt : public llama_model_base {
llama_model_mpt(const struct llama_model_params & params) : llama_model_base(params) {} llama_model_mpt(const struct llama_model_params & params) : llama_model_base(params) {}
void load_arch_hparams(llama_model_loader & ml) override; void load_arch_hparams(llama_model_loader & ml) override;