语言:
Bespoke-MiniChart-7B
这是由Bespoke Labs开发、Liyan Tang与Bespoke Labs维护的开源图表理解视觉语言模型(VLM)。该模型在70亿参数规模的图表问答(Chart-QA)任务上创造了新标杆,在七个公开基准测试中超越了Gemini-1.5-Pro和Claude-3.5等更大规模的闭源模型。
- 技术博客: https://www.bespokelabs.ai/blog/bespoke-minichart-7b
- 在线体验: https://playground.bespokelabs.ai/minichart
示例输出
以下案例展示了Bespoke-MiniChart-7B如何同时实现视觉感知与文本推理能力。
模型性能
Bespoke-MiniChart-7B在同规模模型中实现了最先进的图表理解能力,甚至能超越Gemini-1.5-Pro和Claude-3.5等闭源模型。
我们对比了仅使用SFT与采用SFT+DPO策略微调的模型效果。下表中M1和M2分别是使用27万和100万SFT样本微调的模型,Bespoke-MiniChart-7B则是采用SFT+DPO联合训练的最终版本。
使用方式

可通过在线平台体验: https://playground.bespokelabs.ai/minichart
也可通过以下代码片段运行模型:
import requests
from PIL import Image
from io import BytesIO
import base64
import matplotlib.pyplot as plt
from vllm import LLM, SamplingParams
QA_PROMPT = """请根据图表回答问题。
问题: [QUESTION]
请先陈述推理过程,再给出最终答案。使用以下格式:
<think>
... 您的思考过程 ...
</think>
<answer>
... 最终答案(实体或数字) ...
</answer>"""
def get_image_from_url(image_url):
try:
response = requests.get(image_url, stream=True)
response.raise_for_status()
return Image.open(BytesIO(response.content))
except Exception as e:
print(f"图像获取错误: {e}")
return None
def get_answer(image_url, question, display=True):
image = get_image_from_url(image_url)
if display:
plt.figure(figsize=(10, 8))
plt.imshow(image)
plt.axis('off')
plt.show()
if not image:
return "图像下载失败"
buffered = BytesIO()
image.save(buffered, format=image.format or 'JPEG')
encoded_image = base64.b64encode(buffered.getvalue()).decode('utf-8')
messages = [{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{encoded_image}"}},
{"type": "text", "text": QA_PROMPT.replace("[QUESTION]", question)}
]
}]
response = llm.chat([messages], sampling_params=SamplingParams(temperature=0, max_tokens=500))
return response[0].outputs[0].text
llm = LLM(
model="bespokelabs/Bespoke-MiniChart-7B",
tokenizer_mode="auto",
max_model_len=15000,
tensor_parallel_size=1,
gpu_memory_utilization=0.9,
mm_processor_kwargs={"max_pixels": 1600*28*28},
seed=2025,
trust_remote_code=True,
)
image_url = "https://github.com/bespokelabsai/minichart-playground-examples/blob/main/images/ilyc9wk4jf8b1.png?raw=true"
question = "2022年有多少个全球区域的初创企业融资损失保持在30%以下?"
print("\n\n=================模型输出:===============\n\n", get_answer(image_url, question))
许可协议
本作品采用CC BY-NC 4.0许可。如需商业授权,请联系company@bespokelabs.ai。
引用文献
@misc{bespoke_minichart_7b,
title = {Bespoke-MiniChart-7B: 推动开源VLM在图表理解领域的边界},
author = {Liyan Tang and Shreyas Pimpalgaonkar and Kartik Sharma and Alexandros G. Dimakis and Mahesh Sathiamoorthy and Greg Durrett},
howpublished = {技术博客},
year = {2025},
url={https://huggingface.co/bespokelabs/Bespoke-MiniChart-7B},
}
致谢
Bespoke Labs核心团队:
- 唐立言
- 施雷亚斯·平帕尔冈卡
- 卡蒂克·夏尔马
- 亚历克斯·迪马基斯
- 马赫什·萨蒂亚穆尔蒂
- 格雷格·达雷特
本模型由Bespoke Labs匠心打造——在精心数据策展与尖端建模技术的交汇处诞生。