abetlen / abetlen/llama-cpp-python
How to import photos into LLM llava?
- 主要言語
- Python
- スター
- 10.6k
- フォーク
- 1.4k
- PR マージ指標
- PR 指標を取得中
説明
Please help me how llava can answer a question about the included photo.
Below is my current code.
`
from langchain_community.llms import LlamaCpp
from langchain_core.callbacks import CallbackManager, StreamingStdOutCallbackHandler
from langchain_core.prompts import PromptTemplate
from PIL import Image
import requests
template = """Question: {question}
Answer: Let's work this out in a step by step way to be sure we have the right answer."""
prompt = PromptTemplate.from_template(template)
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
llm = LlamaCpp(
model_path="model/llava-v1.6-mistral-7b.Q5_K_M.gguf",
temperature=0.75,
max_tokens=2000,
top_p=1,
callback_manager=callback_manager,
verbose=True, # Verbose is required to pass to the callback manager
)
question = """
Question: Can you identify the photo?
"""
llm.invoke(question)
`
コントリビューションガイド
評価
この issue はまだ評価されていません。