🚀 TinyLLaVA
TinyLLaVA发布了一系列小规模的大多模态模型(LMMs),模型规模从14亿参数到31亿参数不等。我们表现最优的模型TinyLLaVA - Phi - 2 - SigLIP - 3.1B,在整体性能上优于现有的70亿参数模型,如LLaVA - 1.5和Qwen - VL。
🚀 快速开始
这里,我们介绍TinyLLaVA - Phi - 2 - SigLIP - 3.1B,它是由TinyLLaVA Factory代码库训练得到的。对于大语言模型(LLM)和视觉塔,我们分别选择了[Phi - 2](microsoft/phi - 2)和[siglip - so400m - patch14 - 384](https://huggingface.co/google/siglip - so400m - patch14 - 384)。用于训练该模型的数据集是[ShareGPT4V](https://github.com/InternLM/InternLM - XComposer/blob/main/projects/ShareGPT4V/docs/Data.md)数据集。
💻 使用示例
基础用法
from transformers import AutoTokenizer, AutoModelForCausalLM
hf_path = 'tinyllava/TinyLLaVA-Phi-2-SigLIP-3.1B'
model = AutoModelForCausalLM.from_pretrained(hf_path, trust_remote_code=True)
model.cuda()
config = model.config
tokenizer = AutoTokenizer.from_pretrained(hf_path, use_fast=False, model_max_length = config.tokenizer_model_max_length,padding_side = config.tokenizer_padding_side)
prompt="What are these?"
image_url="http://images.cocodataset.org/test-stuff2017/000000000001.jpg"
output_text, genertaion_time = model.chat(prompt=prompt, image=image_url, tokenizer=tokenizer)
print('model output:', output_text)
print('runing time:', genertaion_time)
📚 详细文档
结果展示
模型名称 |
VQAv2 |
GQA |
SQA |
TextVQA |
MM - VET |
POPE |
MME |
MMMU |
[LLaVA - 1.5 - 7B](https://huggingface.co/llava - hf/llava - 1.5 - 7b - hf) |
78.5 |
62.0 |
66.8 |
58.2 |
30.5 |
85.9 |
1510.7 |
- |
[bczhou/TinyLLaVA - 3.1B](https://huggingface.co/bczhou/TinyLLaVA - 3.1B) (我们的旧模型) |
79.9 |
62.0 |
69.1 |
59.1 |
32.0 |
86.4 |
1464.9 |
- |
[tinyllava/TinyLLaVA - Gemma - SigLIP - 2.4B](https://huggingface.co/tinyllava/TinyLLaVA - Gemma - SigLIP - 2.4B) |
78.4 |
61.6 |
64.4 |
53.6 |
26.9 |
86.4 |
1339.0 |
31.7 |
[tinyllava/TinyLLaVA - Phi - 2 - SigLIP - 3.1B](https://huggingface.co/tinyllava/TinyLLaVA - Phi - 2 - SigLIP - 3.1B) |
80.1 |
62.1 |
73.0 |
60.3 |
37.5 |
87.2 |
1466.4 |
38.4 |
关于TinyLLaVA Factory
TinyLLaVA Factory是一个开源的模块化代码库,专注于小规模大多模态模型的开发,具有代码实现简单、新特性易于扩展以及训练结果可复现等特点。该代码库提供了标准的训练和评估流程、灵活的数据预处理和模型配置,以及易于扩展的架构。用户可以用最少的编码工作和更少的编码错误来定制自己的大多模态模型。
TinyLLaVA Factory集成了一系列前沿的模型和方法:
- 大语言模型(LLM)目前支持OpenELM、TinyLlama、StableLM、Qwen、Gemma和Phi。
- 视觉塔目前支持CLIP、SigLIP、Dino以及CLIP和Dino的组合。
- 连接器目前支持MLP、Qformer和Resampler。
📄 许可证
本项目采用Apache - 2.0许可证。