@@ -13551,6 +13551,26 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
1355113551 yield from super().modify_tensors(data_torch, name, bid)
1355213552
1355313553
13554+ @ModelBase.register("Sarashina2VisionForCausalLM")
13555+ class Sarashina2VLTextModel(LlamaModel):
13556+ model_arch = gguf.MODEL_ARCH.LLAMA
13557+
13558+ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None):
13559+ if name.startswith("llm."):
13560+ name = name.replace("llm.", "", 1)
13561+ elif name.startswith("norm.") or name.startswith("visual."):
13562+ return
13563+
13564+ yield from super().modify_tensors(data_torch, name, bid)
13565+
13566+
13567+ @ModelBase.register("Sarashina2VisionForCausalLM")
13568+ class Sarashina2VLVisionModel(Qwen2VLVisionModel):
13569+ def __init__(self, *args, **kwargs):
13570+ super().__init__(*args, **kwargs)
13571+ self.global_config['model_type'] = "qwen2_vl"
13572+
13573+
1355413574###### CONVERSION LOGIC ######
1355513575
1355613576
@@ -13807,7 +13827,7 @@ def get_model_architecture(hparams: dict[str, Any], model_type: ModelType) -> st
1380713827 # Step3-VL keeps text config under text_config but uses a custom top-level architecture.
1380813828 # For text conversion we route to a dedicated text-only class.
1380913829 # TODO: refactor this later to avoid adding exception here
13810- if model_type == ModelType.TEXT and arch == "StepVLForConditionalGeneration":
13830+ if model_type == ModelType.TEXT and arch in ( "StepVLForConditionalGeneration", "Sarashina2VisionForCausalLM") :
1381113831 return arch
1381213832
1381313833 # if "architectures" is found in the sub-config, use that instead
0 commit comments