Closed pribadihcr closed 9 months ago
please change "image = Image.open(image_path).convert('RGB')" to "image = Image.open(img).convert('RGB')"
everytime you open the file "image_path" rather than "img"
@THUCSTHanxu13 ,
Sorry, the issue still exists.
images = ["a.jpg", "b.jpg", "c.jpg"]
for img in images:
image = Image.open(img).convert('RGB')
res, context, _ = model.chat(
image=image,
msgs=msgs,
context=None,
tokenizer=tokenizer,
sampling=False,
temperature=0.0
)
print(res)
Do you still have questions? @pribadihcr
model = AutoModel.from_pretrained('openbmb/MiniCPM-V', trust_remote_code=True, cache_dir="./cache")
tokenizer = AutoTokenizer.from_pretrained('openbmb/MiniCPM-V', trust_remote_code=True, cache_dir="./cache")
prompt = 'What is this photo about? Please answer with details.'
msgs = [{'role': 'user', 'content': prompt}]
images = ["a.jpg", "b.jpg", "c.jpg"]
for img in images:
image = Image.open(img).convert('RGB')
res, context, _ = model.chat(
image=image,
msgs=msgs,
context=None,
tokenizer=tokenizer,
sampling=False,
temperature=0.0
)
print(res)
@ShengdingHu, with the script above give the same output. Please double check with reproduce it. Thank you.
@pribadihcr You should put msgs inside the for loop,because msgs are updated when called model.chat
Hi, I tried to infer MiniCPM-V different images in loops. But got the same result.
the "res" has the same output.