Skip to content

Commit 40f0536

Browse files
authored
Merge pull request #132 from JayAnderson360/main
fix: wire LFM2.5-VL chat handlers into server loader
2 parents d9cc25b + a32daf7 commit 40f0536

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

llama_cpp/server/model.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)