Molmo2 是由艾伦人工智能研究所(Ai2)开发的一系列开放视觉语言模型,支持图像、视频和多图像的理解与定位。 Molmo2 模型的训练基于公开可用的第三方数据集,相关参考可查阅我们的技术报告和Molmo2 数据集——这是一个包含高度精选图像文本和视频文本对的数据集集合。 在同等规模的多模态模型中,它拥有最先进的性能。 您可以在此处找到 Molmo2 系列的所有模型。
通过我们的公告博客文章,了解更多关于 Molmo2 系列的信息。
Molmo2-VideoPoint-4B 基于 Qwen3-4B-Instruct 构建,并使用 SigLIP 2 作为视觉主干网络。 与通用检查点不同,Molmo2-VideoPoint-4B 在 pixmo-cap、pixmo-points 和 tulu 数据集上完成预训练后,仅在 Molmo2-VideoPoint 数据集上进行微调。它专门用于视频指向和计数任务。
Ai2 致力于开放科学。Molmo2 数据集可在此处获取。 创建 Molmo2 所使用的所有其他成果(训练代码、评估方法、中间检查点)将在稍后发布,以进一步践行我们对开源 AI 开发和可复现性的承诺。
快速链接:
conda create --name transformers4571 python=3.11
conda activate transformers4571
pip install transformers==4.57.1
pip install torch pillow einops torchvision accelerate decord2 molmo_utilsfrom transformers import AutoProcessor, AutoModelForImageTextToText
import torch
from molmo_utils import process_vision_info
import re
model_id="allenai/Molmo2-VideoPoint-4B"
# load the processor
processor = AutoProcessor.from_pretrained(
model_id,
trust_remote_code=True,
dtype="auto",
device_map="auto"
)
# load the model
model = AutoModelForImageTextToText.from_pretrained(
model_id,
trust_remote_code=True,
dtype="auto",
device_map="auto"
)
COORD_REGEX = re.compile(rf"<(?:points|tracks).*? coords=\"([0-9\t:;, .]+)\"/?>")
FRAME_REGEX = re.compile(rf"(?:^|\t|:|,|;)([0-9\.]+) ([0-9\. ]+)")
POINTS_REGEX = re.compile(r"([0-9]+) ([0-9]{3,4}) ([0-9]{3,4})")
def _points_from_num_str(text, image_w, image_h, extract_ids=False):
all_points = []
for points in POINTS_REGEX.finditer(text):
ix, x, y = points.group(1), points.group(2), points.group(3)
# our points format assume coordinates are scaled by 1000
x, y = float(x)/1000*image_w, float(y)/1000*image_h
if 0 <= x <= image_w and 0 <= y <= image_h:
yield ix, x, y
def extract_video_points(text, image_w, image_h, extract_ids=False):
"""Extract video pointing coordinates as a flattened list of (t, x, y) triplets from model output text."""
all_points = []
for coord in COORD_REGEX.finditer(text):
for point_grp in FRAME_REGEX.finditer(coord.group(1)):
frame_id = float(point_grp.group(1))
w, h = (image_w, image_h)
for idx, x, y in _points_from_num_str(point_grp.group(2), w, h):
if extract_ids:
all_points.append((frame_id, idx, x, y))
else:
all_points.append((frame_id, x, y))
return all_points
messages = [
{
"role": "user",
"content": [
dict(type="text", text="Point to the penguins."),
dict(type="video", video="https://storage.googleapis.com/oe-training-public/demo_videos/many_penguins.mp4"),
],
}
]
# process the video using `molmo_utils.process_vision_info`
_, videos, video_kwargs = process_vision_info(messages)
videos, video_metadatas = zip(*videos)
videos, video_metadatas = list(videos), list(video_metadatas)
# apply the chat template to the input messages
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# process the video and text
inputs = processor(
videos=videos,
video_metadata=video_metadatas,
text=text,
padding=True,
return_tensors="pt",
**video_kwargs,
)
inputs = {k: v.to(model.device) for k, v in inputs.items()}
# generate output
with torch.inference_mode():
generated_ids = model.generate(**inputs, max_new_tokens=2048)
# only get generated tokens; decode them to text
generated_tokens = generated_ids[0, inputs['input_ids'].size(1):]
generated_text = processor.tokenizer.decode(generated_tokens, skip_special_tokens=True)
# decode video pointing outputs
points = extract_video_points(generated_text, image_w=video_metadatas[0]["width"], image_h=video_metadatas[0]["height"])
print(points)我们在此报告 Molmo2-VideoCountEval 的准确率和近似准确率。 有关评估的详细信息,请参阅我们的技术报告。
| 模型 | 准确率 | 近似准确率 |
|---|---|---|
| GPT-5 | 35.8 | 50.3 |
| GPT-5 mini | 29.8 | 49.3 |
| Gemini 3 Pro | 37.1 | 53.1 |
| Gemini 2.5 Pro | 35.8 | 56.5 |
| Gemini 2.5 Flash | 31.9 | 48.2 |
| Claude Sonnet 4.5 | 27.2 | 45.1 |
| Qwen3-VL-4B | 25.3 | 44.3 |
| Qwen3-VL-8B | 29.6 | 47.7 |
| Molmo2-4B | 34.3 | 56.1 |
| Molmo2-8B | 35.5 | 53.3 |
| Molmo2-7B | 33.2 | 50.5 |
| Molmo2-VideoPoint-4B (本模型) | 36.8 | 56.5 |
本模型基于 Apache 2.0 许可协议。其旨在按照 Ai2 的负责任使用指南进行研究和教育用途。 本模型使用第三方数据集进行训练,这些数据集仅适用于学术和非商业研究用途。请查阅相关来源以确定本模型是否适合您的使用场景。