/ Модель

Характеристики

Контекст
131 072 токена
Размер весов
32,4 ГБ
Лицензия
Apache 2.0
Архитектура
ovis · dense
Библиотека
transformers
Опубликована
10 фев 2025

Ovis2-16B

Генерация текстаТекст → текст15 профессий

Ovis2-16B — мультимодальная модель для диалога, рассуждений и извлечения информации из изображений и видео.

192скачиваний за 30 дней101лайквеса обновлены15 авг 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Ovis2-16B — мультимодальная языковая модель семейства Ovis, разработанная командой AIDC-AI. Она объединяет визуальный энкодер и языковую модель для диалога по изображениям и видео. Архитектура плотная, класс Ovis; репозиторий содержит веса Safetensors. Вариант 16B показан в тестах изображений и видео, а README рекомендует более новую версию Ovis2.5.

Модель предназначена для ответов на вопросы по визуальным материалам, рассуждений по нескольким изображениям и кадрам, многоязычного OCR, а также извлечения структурированных данных из таблиц и диаграмм. В обучении использовались instruction tuning и preference learning для усиления рассуждений; заявлена поддержка английского и китайского, а OCR улучшен для языков помимо них. Для запуска README приводит зависимости PyTorch, Transformers и Flash Attention.

Модель распространяется по лицензии Apache-2.0. В README отмечены ограничения: разработчики не гарантируют полного отсутствия проблем с авторскими правами или некорректного содержимого; для новых возможностей рекомендуется Ovis2.5.

Сценарии применения

  • ответы на вопросы по содержимому изображения
  • описание и сопоставление нескольких изображений
  • анализ последовательности видеокадров
  • многоязычное распознавание текста на изображениях
  • извлечение данных из таблиц и диаграмм

Ограничения

Разработчики не гарантируют полного отсутствия проблем с авторскими правами или некорректных ответов. README рекомендует более новую версию Ovis2.5.

Для каких профессий подходит15

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Ovis2-16B

It is recommended to use the latest version: Ovis2.5.

Introduction

GitHub | Paper

We are pleased to announce the release of Ovis2, our latest advancement in multi-modal large language models (MLLMs). Ovis2 inherits the innovative architectural design of the Ovis series, aimed at structurally aligning visual and textual embeddings. As the successor to Ovis1.6, Ovis2 incorporates significant improvements in both dataset curation and training methodologies.

Key Features:

  • Small Model Performance: Optimized training strategies enable small-scale models to achieve higher capability density, demonstrating cross-tier leading advantages.

  • Enhanced Reasoning Capabilities: Significantly strengthens Chain-of-Thought (CoT) reasoning abilities through the combination of instruction tuning and preference learning.

  • Video and Multi-Image Processing: Video and multi-image data are incorporated into training to enhance the ability to handle complex visual information across frames and images.

  • Multilingual Support and OCR: Enhances multilingual OCR beyond English and Chinese and improves structured data extraction from complex visual elements like tables and charts.

Model Zoo

Ovis MLLMsViTLLMModel WeightsDemo
Ovis2-1Baimv2-large-patch14-448Qwen2.5-0.5B-InstructHuggingfaceSpace
Ovis2-2Baimv2-large-patch14-448Qwen2.5-1.5B-InstructHuggingfaceSpace
Ovis2-4Baimv2-huge-patch14-448Qwen2.5-3B-InstructHuggingfaceSpace
Ovis2-8Baimv2-huge-patch14-448Qwen2.5-7B-InstructHuggingfaceSpace
Ovis2-16Baimv2-huge-patch14-448Qwen2.5-14B-InstructHuggingfaceSpace
Ovis2-34Baimv2-1B-patch14-448Qwen2.5-32B-InstructHuggingface-

Performance

We use VLMEvalKit, as employed in the OpenCompass multimodal and reasoning leaderboard, to evaluate Ovis2.

image/png

Image Benchmark

BenchmarkQwen2.5-VL-72BInternVL2.5-38B-MPOInternVL2.5-26B-MPOOvis1.6-27BLLaVA-OV-72BOvis2-16BOvis2-34B
MMBench-V1.1test87.885.484.282.284.485.686.6
MMStar71.170.167.763.565.867.269.2
MMMUval67.963.856.460.356.660.766.7
MathVistatestmini70.873.671.570.268.473.776.1
HallusionBench58.859.752.454.147.956.858.8
AI2D88.287.986.286.686.286.388.3
OCRBench88.189.490.585.674.187.989.4
MMVet76.772.668.16860.668.477.1
MMBenchtest88.286.485.484.685.687.187.8
MMT-Benchval69.169.165.768.2-69.271.2
RealWorldQA75.974.473.772.773.974.175.6
BLINK62.363.262.648-59.060.1
QBench-76.176.077.7-79.579.8
ABench-78.679.476.5-79.478.7
MTVQA-31.228.726.5-30.330.6

Video Benchmark

BenchmarkQwen2.5-VL-72BInternVL2.5-38BInternVL2.5-26BLLaVA-OneVision-72BOvis2-16BOvis2-34B
VideoMME(wo/w-subs)73.3/79.170.7 / 73.166.9 / 69.266.2/69.570.0/74.471.2/75.6
MVBench70.474.475.259.468.670.3
MLVU(M-Avg/G-Avg)74.6/-75.3/-72.3/-68.0/-77.7/4.4477.8/4.59
MMBench-Video2.021.821.86-1.921.98
TempCompass74.8---74.1675.97

Reasoning Benchmark

image/png

Usage

Below is a code snippet demonstrating how to run Ovis with various input types. For additional usage instructions, including inference wrapper and Gradio UI, please refer to Ovis GitHub.

pip install torch==2.4.0 transformers==4.46.2 numpy==1.25.0 pillow==10.3.0
pip install flash-attn==2.7.0.post2 --no-build-isolation
import torch
from PIL import Image
from transformers import AutoModelForCausalLM

# load model
model = AutoModelForCausalLM.from_pretrained("AIDC-AI/Ovis2-16B",
                                             torch_dtype=torch.bfloat16,
                                             multimodal_max_length=32768,
                                             trust_remote_code=True).cuda()
text_tokenizer = model.get_text_tokenizer()
visual_tokenizer = model.get_visual_tokenizer()

# single-image input
image_path = '/data/images/example_1.jpg'
images = [Image.open(image_path)]
max_partition = 9
text = 'Describe the image.'
query = f'<image>\n{text}'

## cot-style input
# cot_suffix = "Provide a step-by-step solution to the problem, and conclude with 'the answer is' followed by the final solution."
# image_path = '/data/images/example_1.jpg'
# images = [Image.open(image_path)]
# max_partition = 9
# text = "What's the area of the shape?"
# query = f'<image>\n{text}\n{cot_suffix}'

## multiple-images input
# image_paths = [
#     '/data/images/example_1.jpg',
#     '/data/images/example_2.jpg',
#     '/data/images/example_3.jpg'
# ]
# images = [Image.open(image_path) for image_path in image_paths]
# max_partition = 4
# text = 'Describe each image.'
# query = '\n'.join([f'Image {i+1}: <image>' for i in range(len(images))]) + '\n' + text

## video input (require `pip install moviepy==1.0.3`)
# from moviepy.editor import VideoFileClip
# video_path = '/data/videos/example_1.mp4'
# num_frames = 12
# max_partition = 1
# text = 'Describe the video.'
# with VideoFileClip(video_path) as clip:
#     total_frames = int(clip.fps * clip.duration)
#     if total_frames <= num_frames:
#         sampled_indices = range(total_frames)
#     else:
#         stride = total_frames / num_frames
#         sampled_indices = [min(total_frames - 1, int((stride * i + stride * (i + 1)) / 2)) for i in range(num_frames)]
#     frames = [clip.get_frame(index / clip.fps) for index in sampled_indices]
#     frames = [Image.fromarray(frame, mode='RGB') for frame in frames]
# images = frames
# query = '\n'.join(['<image>'] * len(images)) + '\n' + text

## text-only input
# images = []
# max_partition = None
# text = 'Hello'
# query = text

# format conversation
prompt, input_ids, pixel_values = model.preprocess_inputs(query, images, max_partition=max_partition)
attention_mask = torch.ne(input_ids, text_tokenizer.pad_token_id)
input_ids = input_ids.unsqueeze(0).to(device=model.device)
attention_mask = attention_mask.unsqueeze(0).to(device=model.device)
if pixel_values is not None:
    pixel_values = pixel_values.to(dtype=visual_tokenizer.dtype, device=visual_tokenizer.device)
pixel_values = [pixel_values]

# generate output
with torch.inference_mode():
    gen_kwargs = dict(
        max_new_tokens=1024,
        do_sample=False,
        top_p=None,
        top_k=None,
        temperature=None,
        repetition_penalty=None,
        eos_token_id=model.generation_config.eos_token_id,
        pad_token_id=text_tokenizer.pad_token_id,
        use_cache=True
    )
    output_ids = model.generate(input_ids, pixel_values=pixel_values, attention_mask=attention_mask, **gen_kwargs)[0]
    output = text_tokenizer.decode(output_ids, skip_special_tokens=True)
    print(f'Output:\n{output}')
import torch
from PIL import Image
from transformers import AutoModelForCausalLM

# load model
model = AutoModelForCausalLM.from_pretrained("AIDC-AI/Ovis2-16B",
                                             torch_dtype=torch.bfloat16,
                                             multimodal_max_length=32768,
                                             trust_remote_code=True).cuda()
text_tokenizer = model.get_text_tokenizer()
visual_tokenizer = model.get_visual_tokenizer()

# preprocess inputs
batch_inputs = [
    ('/data/images/example_1.jpg', 'What colors dominate the image?'),
    ('/data/images/example_2.jpg', 'What objects are depicted in this image?'),
    ('/data/images/example_3.jpg', 'Is there any text in the image?')
]

batch_input_ids = []
batch_attention_mask = []
batch_pixel_values = []

for image_path, text in batch_inputs:
    image = Image.open(image_path)
    query = f'<image>\n{text}'
    prompt, input_ids, pixel_values = model.preprocess_inputs(query, [image], max_partition=9)
    attention_mask = torch.ne(input_ids, text_tokenizer.pad_token_id)
    batch_input_ids.append(input_ids.to(device=model.device))
    batch_attention_mask.append(attention_mask.to(device=model.device))
    batch_pixel_values.append(pixel_values.to(dtype=visual_tokenizer.dtype, device=visual_tokenizer.device))

batch_input_ids = torch.nn.utils.rnn.pad_sequence([i.flip(dims=[0]) for i in batch_input_ids], batch_first=True,
                                                  padding_value=0.0).flip(dims=[1])
batch_input_ids = batch_input_ids[:, -model.config.multimodal_max_length:]
batch_attention_mask = torch.nn.utils.rnn.pad_sequence([i.flip(dims=[0]) for i in batch_attention_mask],
                                                       batch_first=True, padding_value=False).flip(dims=[1])
batch_attention_mask = batch_attention_mask[:, -model.config.multimodal_max_length:]

# generate outputs
with torch.inference_mode():
    gen_kwargs = dict(
        max_new_tokens=1024,
        do_sample=False,
        top_p=None,
        top_k=None,
        temperature=None,
        repetition_penalty=None,
        eos_token_id=model.generation_config.eos_token_id,
        pad_token_id=text_tokenizer.pad_token_id,
        use_cache=True
    )
    output_ids = model.generate(batch_input_ids, pixel_values=batch_pixel_values, attention_mask=batch_attention_mask,
                                **gen_kwargs)

for i in range(len(batch_inputs)):
    output = text_tokenizer.decode(output_ids[i], skip_special_tokens=True)
    print(f'Output {i + 1}:\n{output}\n')

Citation

If you find Ovis useful, please consider citing the paper

@article{lu2024ovis,
  title={Ovis: Structural Embedding Alignment for Multimodal Large Language Model},
  author={Shiyin Lu and Yang Li and Qing-Guo Chen and Zhao Xu and Weihua Luo and Kaifu Zhang and Han-Jia Ye},
  year={2024},
  journal={arXiv:2405.20797}
}

License

This project is licensed under the Apache License, Version 2.0 (SPDX-License-Identifier: Apache-2.0).

Disclaimer

We used compliance-checking algorithms during the training process, to ensure the compliance of the trained model to the best of our ability. Due to the complexity of the data and the diversity of language model usage scenarios, we cannot guarantee that the model is completely free of copyright issues or improper content. If you believe anything infringes on your rights or generates improper content, please contact us, and we will promptly address the matter.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
Ovis
Ревизия весов
5dea274

0 моделей