/ Модель

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

Контекст
1 024 токена
Архитектура
infimm-zephyr · dense
Опубликована
4 янв 2024

infimm-zephyr

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

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

93скачиваний за 30 дней10лайковвеса обновлены6 мар 2024

Бенчмарки

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

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

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

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

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

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

InfiMM-Zephyr — визуально-языковая модель, разработанная Институтом автоматизации Китайской академии наук и ByteDance как открытая реализация подхода Flamingo. Она предназначена для диалога о изображениях, генерации описаний и ответов на вопросы по визуальному содержимому. Архитектура объединяет Zephyr-7B-beta, визуальный кодировщик EVA CLIP и модуль Cross Attention; данные изображений и текста обрабатываются через Perceiver Resampler. Модель принимает изображения и текст, а генерирует текст на английском языке; в метаданных указан контекст 1024 токена.

Модель обучалась на смешанных наборах веб-документов с чередованием изображений и текста, пар изображение—текст и данных для визуальных вопросов и ответов. Разработчики отмечают бета-статус, а также частичную доступность обучающих данных из-за истёкших ссылок на изображения. Лицензия описана в разделе License карточки, но её условия в доступных сведениях не приведены.

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

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

Ограничения

Модель находится в бета-стадии, поэтому качество может быть нестабильным. Обучающие данные частично ограничены из-за истёкших ссылок на изображения; доступные сведения не раскрывают точные условия лицензии.

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

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

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

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

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

Открыть на Hugging Face

InfiMM

InfiMM, inspired by the Flamingo architecture, sets itself apart with unique training data and diverse large language models (LLMs). This approach allows InfiMM to maintain the core strengths of Flamingo while offering enhanced capabilities. As the premier open-sourced variant in this domain, InfiMM excels in accessibility and adaptability, driven by community collaboration. It's more than an emulation of Flamingo; it's an innovation in visual language processing.

Our model is another attempt to produce the result reported in the paper "Flamingo: A Large-scale Visual Language Model for Multimodal Understanding" by DeepMind. Compared with previous open-sourced attempts (OpenFlamingo and IDEFIC), InfiMM offers a more flexible models, allowing for a wide range of applications. In particular, InfiMM integrates the latest LLM models into VLM domain the reveals the impact of LLMs with different scales and architectures.

Please note that InfiMM is currently in beta stage and we are continuously working on improving it.

Model Details

  • Developed by: Institute of Automation, Chinese Academy of Sciences and ByteDance
  • Model Type: Visual Language Model (VLM)
  • Language: English
  • LLMs: Zephyr, LLaMA2-13B, Vicuna-13B
  • Vision Model: EVA CLIP
  • Language(s) (NLP): en
  • License: see License section

Model Family

Our model consists of several different model. Please see the details below.

ModelLLMVision EncoderIFT
InfiMM-ZephyrZehpyr-7B-betaViT-L-336No
InfiMM-Llama-13BLlama2-13BViT-G-224No
InfiMM-Vicuna-13BVicuna-13BViT-E-224No
InfiMM-Zephyr-ChatZehpyr-7B-betaViT-L-336Yes
InfiMM-Llama-13B-ChatLlama2-13BViT-G-224Yes
InfiMM-Vicuna-13B-ChatVicuna-13BViT-E-224Yes

Demo

Will be released soon.

Our model adopts the Flamingo architecture, leveraging EVA CLIP as the visual encoder and employing LLaMA2, Vicuna, and Zephyr as language models. The visual and language modalities are connected through a Cross Attention module.

Quickstart

Use the code below to get started with the base model:

import torch
from transformers import AutoModelForCausalLM, AutoProcessor


processor = AutoProcessor.from_pretrained("Infi-MM/infimm-zephyr", trust_remote_code=True)

prompts = [
    {
        "role": "user",
        "content": [
            {"image": "assets/infimm-logo.webp"},
            "Please explain this image to me.",
        ],
    }
]
inputs = processor(prompts)

# use bf16
model = AutoModelForCausalLM.from_pretrained(
    "Infi-MM/infimm-zephyr",
    local_files_only=True,
    torch_dtype=torch.bfloat16,
    trust_remote_code=True,
).eval()


inputs = inputs.to(model.device)
inputs["batch_images"] = inputs["batch_images"].to(torch.bfloat16)
generated_ids = model.generate(
    **inputs,
    min_generation_length=0,
    max_generation_length=256,
)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
print(generated_text)

Training Details

We employed three stages to train our model: pretraining (PT), multi-task training (MTT), and instruction finetuning (IFT). Refer to the table below for detailed configurations in each stage. Due to significant noise in the pretraining data, we aimed to enhance the model's accuracy by incorporating higher-quality data. In the multi-task training (MTT) phase, we utilized substantial training data from diverse datasets. However, as the answer in these data mainly consisted of single words or phrases, the model's conversational ability was limited. Therefore, in the third stage, we introduced a considerable amount of image-text dialogue data (llava665k) for fine-tuning the model's instructions.

Pretraining (PT)

We follow similar training procedures used in IDEFICS.

The model is trained on a mixture of image-text pairs and unstructured multimodal web documents. All data are from public sources. Many image URL links are expired, we are capable of only downloading partial samples. We filter low quality data, here are resulting data we used:

Data SourceType of DataNumber of Tokens in SourceNumber of Images in SourceNumber of SamplesEpochs
OBELICSUnstructured Multimodal Web Documents--101M1
MMC4Unstructured Multimodal Web Documents--53M1
LAIONImage-Text Pairs-115M115M1
COYOImage-Text Pairs-238M238M1
LAION-COCOImage-Text Pairs-140M140M1
PMD*Image-Text Pairs-20M20M1

*PMD is only used in models with 13B LLMs, not the 7B Zephyr model.

During pretraining of interleaved image text sample, we apply masked cross-attention, however, we didn't strictly follow Flamingo, which alternate attention of image to its previous text or later text by change of 0.5.

We use the following hyper parameters:

CategoriesParametersValue
Perceiver ResamplerNumber of Layers6
Number of Latents64
Number of Heads16
Resampler Head Dimension96
TrainingSequence Length384 (13B) / 792 (7B)
Effective Batch Size40*128
Max Images per Sample6
Weight Decay0.1
OptimizerAdam(0.9, 0.999)
Gradient Accumulation Step2
Learning RateInitial Max1e-4
Decay ScheduleConstant
Warmup Step rate0.005
Large-scale OptimizationGradient CheckpointingFalse
Precisionbf16
ZeRO OptimizationStage 2

Multi-Task Training (MTT)

Here we use mix_cap_vqa to represent the mixed training set from COCO caption, TextCap, VizWiz Caption, VQAv2, OKVQA, VizWiz VQA, TextVQA, OCRVQA, STVQA, DocVQA, GQA and ScienceQA-image. For caption, we add prefix such as "Please describe the image." before the question. And for QA, we add "Answer the question using a single word or phrase.". Specifically, for VizWiz VQA, we use "When the provided information is insufficient, respond with 'Unanswerable'. Answer the question using a single word or phrase.". While for ScienceQA-image, we use "Answer with the option's letter from the given choices directly."

Instruction Fine-Tuning (IFT)

For instruction fine-tuning stage, we use the recently released LLaVA-MIX-665k.

We use the following hyper parameters:

CategoriesParametersValue
Perceiver ResamplerNumber of Layers6
Number of Latents64
Number of Heads16
Resampler Head Dimension96
TrainingSequence Length384 (13B) / 792 (7B)
Effective Batch Size64
Max Images per Sample6
Weight Decay0.1
OptimizerAdam(0.9, 0.999)
Gradient Accumulation Step2
Learning RateInitial Max1e-5
Decay ScheduleConstant
Warmup Step rate0.005
Large-scale OptimizationGradient CheckpointingFalse
Precisionbf16
ZeRO OptimizationStage 2

During IFT, similar to pretrain, we keep ViT and LLM frozen for both chat-based LLM (Vicuna and Zephyr). For Llama model, we keep LLM trainable during the IFT stage. We also apply chat-template to process the training samples.

Evaluation

PreTraining Evaluation

We evaluate the pretrained models on the following downstream tasks: Image Captioning and VQA. We also compare with our results with IDEFICS.

ModelShotsCOCO CIDErFlickr30K CIDErVQA v2 AccTextVQA AccOK-VQA Acc
IDEFICS-9B04627.350.925.938.4
49359.755.427.645.5
IDEFICS-80B091.853.76030.945.2
4110.373.764.634.452.4
InfiMM-Zephyr-7B078.860.733.715.217.1
4108.671.959.134.350.5
InfiMM-Llama2-13B085.454.651.624.226.4
4125.287.166.138.255.5
InfiMM-Vicuna13B069.649.660.432.849.2
4118.181.464.238.453.7

IFT Evaluation

In our analysis, we concentrate on two primary benchmarks for evaluating MLLMs: 1) Multi-choice Question Answering (QA) and 2) Open-ended Evaluation. We've observed that the evaluation metrics for tasks like Visual Question Answering (VQA) and Text-VQA are overly sensitive to exact answer matches. This approach can be misleading, particularly when models provide synonymous but technically accurate responses. Therefore, these metrics have been omitted from our comparison for a more precise assessment. The evaluation results are shown in the table below.

ModelScienceQA-ImgMMEMM-VETInfiMM-EvalMMbenchMMMU-ValMMMU-Test
Otter-9B-1292/30624.632.2-22.69-
IDEFICS-9B-Instruct60.6-/----24.53-
InfiMM-Zephyr-7B71.1P: 1406C:32732.836.059.739.435.5
InfiMM-Llama-13b73.0P: 1444.5C: 337.639.20.4559/0.41466.439.135.2
InfiMM-Vicuna-13B74.0P: 1461.2C: 323.536.040.066.737.634.6

Citation

@misc{InfiMM,
      title={InfiMM: Advancing Multimodal Understanding from Flamingo's Legacy through Diverse LLM Integration},
      author={InfiMM Team},
      url={https://huggingface.co/Infi-MM/},
      year={2024}
}

License

This project is licensed under the CC BY-NC 4.0.

The copyright of the images belongs to the original authors.

See LICENSE for more information.

Contact Us

Please feel free to contact us via email infimmbytedance@gmail.com if you have any questions.

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

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

GPU в ailist

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

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

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

Класс архитектуры
InfiMMZephyrModel
Ревизия весов
cd5b78b

0 моделей