# test.pyimport torch
from PIL import Image
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained('openbmb/MiniCPM-V-2_6-int4', trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-V-2_6-int4', trust_remote_code=True)
model.eval()
image = Image.open('xx.jpg').convert('RGB')
question = 'What is in the image?'
msgs = [{'role': 'user', 'content': [image, question]}]
res = model.chat(
image=None,
msgs=msgs,
tokenizer=tokenizer
)
print(res)
## if you want to use streaming, please make sure sampling=True and stream=True## the model.chat will return a generator
res = model.chat(
image=None,
msgs=msgs,
tokenizer=tokenizer,
sampling=True,
temperature=0.7,
stream=True
)
generated_text = ""for new_text in res:
generated_text += new_text
print(new_text, flush=True, end='')
Runs of openbmb MiniCPM-V-2_6-int4 on huggingface.co
5.3K
Total runs
0
24-hour runs
-181
3-day runs
326
7-day runs
326
30-day runs
More Information About MiniCPM-V-2_6-int4 huggingface.co Model
MiniCPM-V-2_6-int4 huggingface.co
MiniCPM-V-2_6-int4 huggingface.co is an AI model on huggingface.co that provides MiniCPM-V-2_6-int4's model effect (), which can be used instantly with this openbmb MiniCPM-V-2_6-int4 model. huggingface.co supports a free trial of the MiniCPM-V-2_6-int4 model, and also provides paid use of the MiniCPM-V-2_6-int4. Support call MiniCPM-V-2_6-int4 model through api, including Node.js, Python, http.
MiniCPM-V-2_6-int4 huggingface.co is an online trial and call api platform, which integrates MiniCPM-V-2_6-int4's modeling effects, including api services, and provides a free online trial of MiniCPM-V-2_6-int4, you can try MiniCPM-V-2_6-int4 online for free by clicking the link below.
openbmb MiniCPM-V-2_6-int4 online free url in huggingface.co:
MiniCPM-V-2_6-int4 is an open source model from GitHub that offers a free installation service, and any user can find MiniCPM-V-2_6-int4 on GitHub to install. At the same time, huggingface.co provides the effect of MiniCPM-V-2_6-int4 install, users can directly use MiniCPM-V-2_6-int4 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.