vision: fix models missing "text_config"

This commit is contained in:
Xuan Son Nguyen 2025-04-30 17:22:28 +02:00
parent f48f51d185
commit b5e72ed350
1 changed files with 2 additions and 0 deletions

View File

@ -1087,6 +1087,8 @@ class VisionModel(ModelBase):
raise TypeError("VisionModel must be subclassed with model_arch = gguf.MODEL_ARCH.CLIP_VISION")
# get n_embd of the text model
if "text_config" not in self.hparams:
self.hparams["text_config"] = {}
text_config = {**self.hparams, **self.hparams["text_config"]}
self.n_embd_text = text_config.get("hidden_size", text_config.get("n_embd", 0))
assert self.n_embd_text > 0, "n_embd not found in hparams"