Skip to content

Commit 00f0f8a

Browse files
committed
convert mistral small
1 parent f4c3dd5 commit 00f0f8a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

convert_hf_to_gguf.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,25 @@ def prepare_tensors(self):
17131713
raise ValueError(f"Unprocessed experts: {experts}")
17141714

17151715

1716+
@Model.register("Mistral3ForConditionalGeneration")
1717+
class Mistral3Model(LlamaModel):
1718+
model_arch = gguf.MODEL_ARCH.LLAMA
1719+
1720+
# we need to merge the text_config into the root level of hparams
1721+
def __init__(self, *args, **kwargs):
1722+
hparams = Model.load_hparams(kwargs["dir_model"])
1723+
if "text_config" in hparams:
1724+
hparams = {**hparams, **hparams["text_config"]}
1725+
kwargs["hparams"] = hparams
1726+
super().__init__(*args, **kwargs)
1727+
1728+
def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None):
1729+
name = name.replace("language_model.", "")
1730+
if "multi_modal_projector" in name or "vision_tower" in name:
1731+
return []
1732+
return super().modify_tensors(data_torch, name, bid)
1733+
1734+
17161735
@Model.register("DeciLMForCausalLM")
17171736
class DeciModel(Model):
17181737
model_arch = gguf.MODEL_ARCH.DECI

0 commit comments

Comments
 (0)