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 还没有评估数据。