Visual Question Answering
Transformers
Safetensors
English
Chinese
minicpmv
feature-extraction
custom_code
Eval Results
Instructions to use openbmb/MiniCPM-V-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM-V-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("visual-question-answering", model="openbmb/MiniCPM-V-2", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("openbmb/MiniCPM-V-2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Multi-turn Conversations with MiniCPM-V: Exploring Single Image Understanding
#3
by JamePeng2023 - opened
Hello openbmb team, can MiniCPM-V engage in multi-turn conversations about a single image?
# First round chat
msgs = [{"role": "user", "content": "Where should I go to buy a camera?"}]
res, context, _ = model.chat(
image=image,
msgs=msgs,
tokenizer=tokenizer
)
print(res)
# Second round chat , append history context to msgs
msgs.append({"role": "assistant", "content": res})
msgs.append({"role": "user", "content": "Where is this store in the image?"})
res, context, _ = model.chat(
image=image,
msgs=msgs,
tokenizer=tokenizer
)
print(res)
It's really a very interesting method. I get the last picture from the chat history and transfer it to the conversation with the big model.
A bug fixed, msgs would be changed after calling model.chat(), please pull the latest file modeling_minicpmv.py