# test.pyimport torch
from PIL import Image
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained('openbmb/MiniCPM-Llama3-V-2_5-int4', trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-Llama3-V-2_5-int4', trust_remote_code=True)
model.eval()
image = Image.open('xx.jpg').convert('RGB')
question = 'What is in the image?'
msgs = [{'role': 'user', 'content': question}]
res = model.chat(
image=image,
msgs=msgs,
tokenizer=tokenizer,
sampling=True, # if sampling=False, beam_search will be used by default
temperature=0.7,
# system_prompt='' # pass system_prompt if needed
)
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=image,
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-Llama3-V-2_5-int4 on huggingface.co
378
Total runs
0
24-hour runs
0
3-day runs
38
7-day runs
38
30-day runs
More Information About MiniCPM-Llama3-V-2_5-int4 huggingface.co Model
MiniCPM-Llama3-V-2_5-int4 huggingface.co
MiniCPM-Llama3-V-2_5-int4 huggingface.co is an AI model on huggingface.co that provides MiniCPM-Llama3-V-2_5-int4's model effect (), which can be used instantly with this openbmb MiniCPM-Llama3-V-2_5-int4 model. huggingface.co supports a free trial of the MiniCPM-Llama3-V-2_5-int4 model, and also provides paid use of the MiniCPM-Llama3-V-2_5-int4. Support call MiniCPM-Llama3-V-2_5-int4 model through api, including Node.js, Python, http.
MiniCPM-Llama3-V-2_5-int4 huggingface.co is an online trial and call api platform, which integrates MiniCPM-Llama3-V-2_5-int4's modeling effects, including api services, and provides a free online trial of MiniCPM-Llama3-V-2_5-int4, you can try MiniCPM-Llama3-V-2_5-int4 online for free by clicking the link below.
openbmb MiniCPM-Llama3-V-2_5-int4 online free url in huggingface.co:
MiniCPM-Llama3-V-2_5-int4 is an open source model from GitHub that offers a free installation service, and any user can find MiniCPM-Llama3-V-2_5-int4 on GitHub to install. At the same time, huggingface.co provides the effect of MiniCPM-Llama3-V-2_5-int4 install, users can directly use MiniCPM-Llama3-V-2_5-int4 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
MiniCPM-Llama3-V-2_5-int4 install url in huggingface.co: