From 06f50ded46892a96395ee796e070f50e8e3330e4 Mon Sep 17 00:00:00 2001 From: pockers21 <134406831+pockers21@users.noreply.github.com> Date: Fri, 14 Nov 2025 18:13:43 +0800 Subject: [PATCH] Simplify Jina BERT v3 detection logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unnecessary try/except Jina text hparams. Co-authored-by: Sigbjørn Skjæret --- convert_hf_to_gguf.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index 518fe3d24f..b861d1c3b8 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -5636,17 +5636,13 @@ class XLMRobertaModel(BertModel): if lora_names := hparams.get("lora_adaptations"): self._lora_names = lora_names - try: - text_cfg = hparams.get("text_config", {}) if isinstance(hparams.get("text_config", {}), dict) else {} - pe_type = (text_cfg.get("position_embedding_type") or hparams.get("position_embedding_type") or "").lower() - rope_base = text_cfg.get("rotary_emb_base", hparams.get("rotary_emb_base")) - name_path = (hparams.get("_name_or_path") or "").lower() - is_vx = ("jina" in name_path and ("v2" in name_path or "v3" in name_path)) - is_v3 = (pe_type == "rotary" or rope_base is not None) and is_vx - if (is_v3) or self._lora_names: - self.model_arch = gguf.MODEL_ARCH.JINA_BERT_V3 - except Exception: - pass + pe_type = (hparams.get("position_embedding_type") or "").lower() + rope_base = hparams.get("rotary_emb_base") + name_path = (hparams.get("_name_or_path") or "").lower() + is_vx = ("jina" in name_path and ("v2" in name_path or "v3" in name_path)) + is_v3 = (pe_type == "rotary" or rope_base is not None) and is_vx + if is_v3 or self._lora_names: + self.model_arch = gguf.MODEL_ARCH.JINA_BERT_V3 super().__init__(dir_model, ftype, fname_out, hparams=hparams, **kwargs) self._xlmroberta_tokenizer_init()