@@ -199,6 +199,34 @@ def load_llama_from_model_settings(settings: ModelSettings) -> llama_cpp.Llama:
199199 chat_handler = llama_cpp .llama_chat_format .Qwen25VLChatHandler (
200200 clip_model_path = settings .clip_model_path , verbose = settings .verbose
201201 )
202+ elif settings .chat_format == "lfm2-vl" :
203+ assert settings .clip_model_path is not None , "clip model not found"
204+ if settings .hf_model_repo_id is not None :
205+ chat_handler = (
206+ llama_cpp .llama_chat_format .LFM2VLChatHandler .from_pretrained (
207+ repo_id = settings .hf_model_repo_id ,
208+ filename = settings .clip_model_path ,
209+ verbose = settings .verbose ,
210+ )
211+ )
212+ else :
213+ chat_handler = llama_cpp .llama_chat_format .LFM2VLChatHandler (
214+ clip_model_path = settings .clip_model_path , verbose = settings .verbose
215+ )
216+ elif settings .chat_format == "lfm2.5-vl" :
217+ assert settings .clip_model_path is not None , "clip model not found"
218+ if settings .hf_model_repo_id is not None :
219+ chat_handler = (
220+ llama_cpp .llama_chat_format .LFM25VLChatHandler .from_pretrained (
221+ repo_id = settings .hf_model_repo_id ,
222+ filename = settings .clip_model_path ,
223+ verbose = settings .verbose ,
224+ )
225+ )
226+ else :
227+ chat_handler = llama_cpp .llama_chat_format .LFM25VLChatHandler (
228+ clip_model_path = settings .clip_model_path , verbose = settings .verbose
229+ )
202230 elif settings .chat_format == "hf-autotokenizer" :
203231 assert (
204232 settings .hf_pretrained_model_name_or_path is not None
0 commit comments