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
有一种方法可以使得模型每次使用chat函数的时候回归到其初始状态吗?
#5
by liudesheng - opened
有一种方法可以使得模型每次使用chat函数的时候回归到其初始状态吗?我使用了
image = Image.open('test.jpg').convert('RGB')
question = 'What is in the image?'
msgs = [{'role': 'user', 'content': question}]
with open('test.txt', 'w') as f:
for i in tqdm(range(5)):
res, context, _ = model.chat(
history=None,
image=image,
msgs=msgs,
context=None,
tokenizer=tokenizer,
sampling=True,
temperature=0.95
)
f.write(f'{res}\n')
del res, context, _
gc.collect()
torch.cuda.empty_cache()
发现在输出几次特征之后便不在输出我想要的信息,而是输出一些类似套话的内容,我推测是它知道自己已经输出了图片的特征,或者img没有被传输给模型。
liudesheng changed discussion status to closed
liudesheng changed discussion status to open
感谢!
liudesheng changed discussion status to closed