char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
fa88ae936
char/aliceai-t5-moe
1from __future__import annotations 2 3from typing import Callable ,TYPE_CHECKING 4 5if TYPE_CHECKING : 6from torch import Tensor 7 8from .base import ModelBase ,gguf 9 10from .llama import LlamaModel 11from .qwenvl import Qwen2VLVisionModel 12 13 14@ ModelBase . register ( "Sarashina2VisionForCausalLM" ) 15@ ModelBase . example ( "sbintuitions/sarashina2.2-vision-3b" ) 16class Sarashina2VLTextModel (LlamaModel ): 17model_arch = gguf .MODEL_ARCH .LLAMA 18 19@classmethod 20def filter_tensors (cls ,item :tuple [str ,Callable [[],Tensor ]])-> tuple [str ,Callable [[],Tensor ]]| None : 21name ,gen = item 22if name .startswith ("llm." ): 23name = name .replace ("llm." ,"" ,1 ) 24elif name .startswith ("norm." ): 25return None 26return super ().filter_tensors ((name ,gen )) 27 28 29@ ModelBase . register ( "Sarashina2VisionForCausalLM" ) 30@ ModelBase . example ( "sbintuitions/sarashina2.2-vision-3b" ) 31class Sarashina2VLVisionModel (Qwen2VLVisionModel ): 32def __init__ (self ,* args ,** kwargs ): 33super ().__init__ (* args ,** kwargs ) 34self .global_config ['model_type' ]= "qwen2_vl"