LLM inference in C/C++
C++ ggml
model : Add LFM2.5-Encoder-350M and LFM2.5-Encoder-230M (#29862)
Tarek Dakhrancb7934c52ca8
diff --git a/conversion/__init__.py b/conversion/__init__.pyindex 6d8ae9c1a5..051ddf99dc 100644--- a/conversion/__init__.py+++ b/conversion/__init__.py@@ -155,6 +155,7 @@ TEXT_MODEL_MAP: dict[str, str] = {"LevModel": "lev","NimbleModel": "lev","Lfm25AudioTokenizer": "lfm2",+ "Lfm2BidirectionalForMaskedLM": "lfm2","Lfm2BidirectionalModel": "lfm2","Lfm2ForCausalLM": "lfm2","Lfm2Model": "lfm2",diff --git a/conversion/lfm2.py b/conversion/lfm2.pyindex 984f444806..e50bbdd0fe 100644--- a/conversion/lfm2.py+++ b/conversion/lfm2.py@@ -65,19 +65,21 @@ class LFM2Model(TextModel):yield from super().modify_tensors(data_torch, name, bid)[email protected]("Lfm2Model", "Lfm2BidirectionalModel")[email protected]("LiquidAI/LFM2.5-ColBERT-350M", "LiquidAI/LFM2.5-Embedding-350M")[email protected]("Lfm2Model", "Lfm2BidirectionalModel", "Lfm2BidirectionalForMaskedLM")[email protected]("LiquidAI/LFM2.5-ColBERT-350M", "LiquidAI/LFM2.5-Embedding-350M", "LiquidAI/LFM2.5-Encoder-350M", "LiquidAI/LFM2.5-Encoder-230M")class LFM2ColBertModel(LFM2Model):model_arch = gguf.MODEL_ARCH.LFM2dense_tensor_name = "dense_2"def set_gguf_parameters(self):super().set_gguf_parameters()- if self.hf_arch == "Lfm2BidirectionalModel":+ if self.hf_arch in ("Lfm2BidirectionalModel", "Lfm2BidirectionalForMaskedLM"):self.gguf_writer.add_causal_attention(False)self._try_set_pooling_type()def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iterable[tuple[str, Tensor]]:+ # masked LM checkpoints use "lfm2." prefix+ name = name.removeprefix("lfm2.")if not name.startswith(self.dense_tensor_name):name = "model." + name