File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -529,19 +529,22 @@ Then you'll need to use a custom chat handler to load the clip model and process
529
529
You can also pull the model from the Hugging Face Hub using the ` from_pretrained ` method.
530
530
531
531
``` python
532
- >> > from llama_cpp import Llama
533
- >> > from llama_cpp.llama_chat_format import MoondreamChatHandler
534
- >> > chat_handler = MoondreamChatHandler.from_pretrained(
532
+ from llama_cpp import Llama
533
+ from llama_cpp.llama_chat_format import MoondreamChatHandler
534
+
535
+ chat_handler = MoondreamChatHandler.from_pretrained(
535
536
repo_id = " vikhyatk/moondream2" ,
536
537
filename = " *mmproj*" ,
537
538
)
538
- >> > llm = Llama.from_pretrained(
539
- repo_id = " vikhyatk/moondream2"
539
+
540
+ llm = Llama.from_pretrained(
541
+ repo_id = " vikhyatk/moondream2" ,
540
542
filename = " *text-model*" ,
541
543
chat_handler = chat_handler,
542
544
n_ctx = 2048 , # n_ctx should be increased to accomodate the image embedding
543
545
)
544
- >> > llm.create_chat_completion(
546
+
547
+ respoonse = llm.create_chat_completion(
545
548
messages = [
546
549
{
547
550
" role" : " user" ,
@@ -553,6 +556,7 @@ You can also pull the model from the Hugging Face Hub using the `from_pretrained
553
556
}
554
557
]
555
558
)
559
+ print (response[" choices" ][0 ][" text" ])
556
560
```
557
561
558
562
** Note** : Multi-modal models also support tool calling and JSON mode.
You can’t perform that action at this time.
0 commit comments