@@ -13684,6 +13684,27 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
1368413684 yield from super().modify_tensors(data_torch, name, bid)
1368513685
1368613686
13687+ @ModelBase.register("Sarashina2VisionForCausalLM")
13688+ class Sarashina2VLTextModel(LlamaModel):
13689+ model_arch = gguf.MODEL_ARCH.LLAMA
13690+
13691+ @classmethod
13692+ def filter_tensors(cls, item: tuple[str, Callable[[], Tensor]]) -> tuple[str, Callable[[], Tensor]] | None:
13693+ name, gen = item
13694+ if name.startswith("llm."):
13695+ name = name.replace("llm.", "", 1)
13696+ elif name.startswith("norm."):
13697+ return None
13698+ return super().filter_tensors((name, gen))
13699+
13700+
13701+ @ModelBase.register("Sarashina2VisionForCausalLM")
13702+ class Sarashina2VLVisionModel(Qwen2VLVisionModel):
13703+ def __init__(self, *args, **kwargs):
13704+ super().__init__(*args, **kwargs)
13705+ self.global_config['model_type'] = "qwen2_vl"
13706+
13707+
1368713708###### CONVERSION LOGIC ######
1368813709
1368913710
@@ -13940,7 +13961,7 @@ def get_model_architecture(hparams: dict[str, Any], model_type: ModelType) -> st
1394013961 # Step3-VL keeps text config under text_config but uses a custom top-level architecture.
1394113962 # For text conversion we route to a dedicated text-only class.
1394213963 # TODO: refactor this later to avoid adding exception here
13943- if model_type == ModelType.TEXT and arch == "StepVLForConditionalGeneration":
13964+ if model_type == ModelType.TEXT and arch in ( "StepVLForConditionalGeneration", "Sarashina2VisionForCausalLM") :
1394413965 return arch
1394513966
1394613967 # if "architectures" is found in the sub-config, use that instead
0 commit comments