模型库 / vikhyatk/moondream2

moondream2

vikhyatk image-text-to-text transformers
vikhyatk/moondream2
2,689,838
下载量
1408
收藏数
7
浏览量
apache-2.0
许可

简介

⚠️ 本仓库包含上一代模型 Moondream 2 的最新版本。Moondream 的最新版本为 Moondream 3(预览版)。

模型卡片

许可协议 apache-2.0
任务 image-text-to-text

模型配置

模型类型 moondream1
架构 HfMoondream

模型详情

已翻译

⚠️ 本仓库包含我们上一代模型 Moondream 2 的最新版本。Moondream 的最新版本为 Moondream 3 (Preview)


Moondream 是一款小型视觉语言模型,旨在高效运行于各种环境。

网站 / 演示 / GitHub

本仓库包含 Moondream 2 的最新(2025-06-21)版本,以及历史版本。该模型会频繁更新,因此如果在生产应用中使用,建议按如下方式指定修订版本。

使用方法

from transformers import AutoModelForCausalLM, AutoTokenizer
from PIL import Image

model = AutoModelForCausalLM.from_pretrained(
    "vikhyatk/moondream2",
    revision="2025-06-21",
    trust_remote_code=True,
    device_map={"": "cuda"}  # ...or 'mps', on Apple Silicon
)

# Captioning
print("Short caption:")
print(model.caption(image, length="short")["caption"])

print("\nNormal caption:")
for t in model.caption(image, length="normal", stream=True)["caption"]:
    # Streaming generation example, supported for caption() and detect()
    print(t, end="", flush=True)
print(model.caption(image, length="normal"))

# Visual Querying
print("\nVisual query: 'How many people are in the image?'")
print(model.query(image, "How many people are in the image?")["answer"])

# Object Detection
print("\nObject detection: 'face'")
objects = model.detect(image, "face")["objects"]
print(f"Found {len(objects)} face(s)")

# Pointing
print("\nPointing: 'person'")
points = model.point(image, "person")["points"]
print(f"Found {len(points)} person(s)")

更新日志

2025-06-21完整发布说明

  • 基于位置的推理
    引入了一种新的逐步推理模式,在回答前明确将推理过程与图像中的空间位置关联,从而实现更精确的视觉解读(例如图表中位数计算、准确计数)。在 query 技能中设置 reasoning=True 即可启用,以在速度与准确性之间进行权衡。
  • 更精准的目标检测
    利用强化学习对更高质量的边界框标注进行训练,减少目标粘连,提升细粒度检测能力(例如区分“蓝色瓶子”与“瓶子”)。
  • 更快的文本生成
    通过新的“超级词” tokenizer 和轻量级 tokenizer 迁移超网络,响应生成速度提升 20–40%,在不损失准确性的前提下减少生成的 token 数量,并便于未来多语言扩展。
  • 改进的 UI 理解
    ScreenSpot(UI 元素定位)性能从 F1\@0.5 的 60.3 提升至 80.4,使 Moondream 在 UI 相关应用中更加高效。
  • 强化学习增强
    对 55 项视觉语言任务应用了强化学习微调,以强化基于位置的推理和检测能力,并计划在下一次更新中扩展至约 120 项任务。

2025-04-15完整发布说明

  1. 改进了图表理解(ChartQA 从 74.8 提升至 77.5,使用 PoT 时达 82.2)
  2. 增加了温度采样和核采样,以减少重复输出
  3. 改进了文档和表格的 OCR(使用提示词“Transcribe the text”或“Transcribe the text in natural reading order”)
  4. 目标检测支持文档布局检测(图形、公式、文本等)
  5. UI 理解(ScreenSpot F1\@0.5 从 53.3 提升至 60.3)
  6. 改进了文本理解(DocVQA 从 76.5 提升至 79.3,TextVQA 从 74.6 提升至 76.3)

2025-03-27完整发布说明

  1. 增加了对长文本描述的支持
  2. 开放词汇图像标注
  3. 改进了计数准确性(例如 CountBenchQA 从 80 提升至 86.4)
  4. 改进了文本理解(例如 OCRBench 从 58.3 提升至 61.2)
  5. 改进了目标检测,尤其是小目标检测(例如 COCO 从 30.5 提升至 51.2)
  6. 修复了影响多字节 unicode 字符的 token 流式传输 bug
  7. HF Transformers 实现中现已支持 gpt-fast 风格的 compile()

标签

moondream1 text-generation custom_code doi:10.57967/hf/6762 license:apache-2.0 endpoints_compatible region:us

操作


详细信息

厂商
vikhyatk
任务
image-text-to-text
框架
transformers
模型类型
moondream1
许可(HF)
apache-2.0