Views
No views yet

| Models | Params (B) | Avg. Score | MMBench | MMStar | MMMUVAL | Math Vista | Hallusion | AI2DTEST | OCRBench | MMVet |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen2-VL-2B | 2.1 | 57.2 | 72.2 | 47.5 | 42.2 | 47.8 | 42.4 | 74.7 | 797 | 51.5 |
| H2OVL-Mississippi-2B | 2.1 | 54.4 | 64.8 | 49.6 | 35.2 | 56.8 | 36.4 | 69.9 | 782 | 44.7 |
| InternVL2-2B | 2.1 | 53.9 | 69.6 | 49.8 | 36.3 | 46.0 | 38.0 | 74.1 | 781 | 39.7 |
| Phi-3-Vision | 4.2 | 53.6 | 65.2 | 47.7 | 46.1 | 44.6 | 39.0 | 78.4 | 637 | 44.1 |
| MiniMonkey | 2.2 | 52.7 | 68.9 | 48.1 | 35.7 | 45.3 | 30.9 | 73.7 | 794 | 39.8 |
| MiniCPM-V-2 | 2.8 | 47.9 | 65.8 | 39.1 | 38.2 | 39.8 | 36.1 | 62.9 | 605 | 41.0 |
| InternVL2-1B | 0.8 | 48.3 | 59.7 | 45.6 | 36.7 | 39.4 | 34.3 | 63.8 | 755 | 31.5 |
| PaliGemma-3B-mix-448 | 2.9 | 46.5 | 65.6 | 48.3 | 34.9 | 28.7 | 32.2 | 68.3 | 614 | 33.1 |
| H2OVL-Mississippi-0.8B | 0.8 | 43.5 | 47.7 | 39.1 | 34.0 | 39.0 | 29.6 | 53.6 | 751 | 30.0 |
| DeepSeek-VL-1.3B | 2.0 | 39.6 | 63.8 | 39.9 | 33.8 | 29.8 | 27.6 | 51.5 | 413 | 29.2 |
transformers.pip install transformers torch torchvision einops timm peft sentencepiecepip install flash_attn1import torch
2from transformers import AutoModel, AutoTokenizer
3
4
5# Set up the model and tokenizer
6model_path = 'h2oai/h2ovl-mississippi-2b'
7model = AutoModel.from_pretrained(
8 model_path,
9 torch_dtype=torch.bfloat16,
10 low_cpu_mem_usage=True,
11 trust_remote_code=True).eval().cuda()
12tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True, use_fast=False)
13generation_config = dict(max_new_tokens=1024, do_sample=True)
14
15
16# pure-text conversation
17question = 'Hello, who are you?'
18response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
19print(f'User: {question}\nAssistant: {response}')
20
21
22# Example for single image
23image_file = './examples/image1.jpg'
24question = '<image>\nPlease describe the image in detail.'
25response, history = model.chat(tokenizer, image_file, question, generation_config, history=None, return_history=True)
26print(f'User: {question}\nAssistant: {response}')
27
28
29# Example for multiple images - multiround conversation
30image_files = ['./examples/image1.jpg', './examples/image2.jpg']
31question = 'Image-1: <image>\nImage-2: <image>\nDescribe the Image-1 and Image-2 in detail.'
32response, history = model.chat(tokenizer, image_files, question, generation_config, history=None, return_history=True)
33print(f'User: {question}\nAssistant: {response}')
34
35question = 'What are the similarities and differences between these two images.'
36response, history = model.chat(tokenizer, image_files, question, generation_config=generation_config, history=history, return_history=True)
37print(f'User: {question}\nAssistant: {response}')
38
39pip install vllm1from vllm import LLM, SamplingParams
2from transformers import AutoTokenizer
3from PIL import Image
4
5question = "Describe this image in detail"
6image = Image.open("assets/a_cat.png")
7model_name = "h2oai/h2ovl-mississippi-2b"
8
9
10llm = LLM(
11 model=model_name,
12)
13
14tokenizer = AutoTokenizer.from_pretrained(model_name,
15 trust_remote_code=True)
16
17messages = [{'role': 'user', 'content': f"<image>\n{question}"}]
18prompt = tokenizer.apply_chat_template(messages,
19 tokenize=False,
20 add_generation_prompt=True)
21
22# Stop tokens for H2OVL-Mississippi
23# https://huggingface.co/h2oai/h2ovl-mississippi-2b
24stop_token_ids = [tokenizer.eos_token_id]
25
26sampling_params = SamplingParams(n=1,
27 temperature=0.8,
28 top_p=0.8,
29 seed=777, # Seed for reprodicibility
30 max_tokens=1024,
31 stop_token_ids=stop_token_ids)
32
33# Single prompt inference
34outputs = llm.generate({
35 "prompt": prompt,
36 "multi_modal_data": {"image": image},
37},
38sampling_params=sampling_params)
39
40# look at the output
41for o in outputs:
42 generated_text = o.outputs[0].text
43 print(generated_text)
44vllm serve h2oai/h2ovl-mississippi-2b --dtype auto --api-key token-abc1231from openai import OpenAI
2client = OpenAI(
3 base_url="http://0.0.0.0:8000/v1",
4 api_key="token-abc123",
5)
6
7# check the model name
8model_name = client.models.list().data[0].id
9print(model_name)
10
11# use chat completion api
12response = client.chat.completions.create(
13 model=model_name,
14 messages=[{
15 'role':
16 'user',
17 'content': [{
18 'type': 'text',
19 'text': 'describe this image in detail',
20 }, {
21 'type': 'image_url',
22 'image_url': {
23 'url':
24 # an image example from https://galaxyofai.com/opencv-with-python-full-tutorial-for-data-science/
25 # this is a cat
26 'https://galaxyofai.com/wp-content/uploads/2023/04/image-42.png',
27 },
28 }],
29 }],
30 temperature=0.8,
31 top_p=0.8)
32print(response)
33
34Extract the details from the form image and structure them into JSON format:
{
"name": "",
"date_of_birth": "",
"address": ""
}1{
2 "name": "John Doe",
3 "date_of_birth": "1990-01-01",
4 "address": "1234 Elm Street, Springfield"
5}Extract the information from the form and format it as follows:
{
"personal_details": {
"name": "",
"age": 0,
"gender": ""
},
"contact": {
"phone": "",
"email": ""
},
"emergency_contact": {
"name": "",
"relation": "",
"phone": ""
}
}1{
2 "personal_details": {
3 "name": "Sarah Connor",
4 "age": 35,
5 "gender": "Female"
6 },
7 "contact": {
8 "phone": "555-1234",
9 "email": "sarah.connor@example.com"
10 },
11 "emergency_contact": {
12 "name": "Kyle Reese",
13 "relation": "Friend",
14 "phone": "555-5678"
15 }
16}Extract the event details from the schedule image and structure them into JSON:
{
"events": [
{
"name": "",
"time": "",
"location": ""
}
]
}1{
2 "events": [
3 {
4 "name": "Morning Meeting",
5 "time": "09:00 AM",
6 "location": "Conference Room 1"
7 },
8 {
9 "name": "Lunch Break",
10 "time": "12:00 PM",
11 "location": "Cafeteria"
12 },
13 {
14 "name": "Project Update",
15 "time": "02:00 PM",
16 "location": "Conference Room 2"
17 }
18 ]
19}Extract the data from the table image and format it as JSON:
{
"products": [
{
"product_name": "",
"price": "",
"quantity": 0
}
]
}1{
2 "products": [
3 {
4 "product_name": "Apples",
5 "price": "$2",
6 "quantity": 10
7 },
8 {
9 "product_name": "Bananas",
10 "price": "$1",
11 "quantity": 20
12 },
13 {
14 "product_name": "Oranges",
15 "price": "$3",
16 "quantity": 15
17 }
18 ]
19}Extract the details of the bar chart from the image, including the title, axis labels, and data points and format it as JSON:
{
"chart": {
"title": "",
"x_axis": "",
"y_axis": "",
"data_points": [
{
"label": "",
"value": 0
}
]
}
}1{
2 "chart": {
3 "title": "Monthly Sales Report",
4 "x_axis": "Months",
5 "y_axis": "Sales (in $)",
6 "data_points": [
7 {
8 "label": "January",
9 "value": 500
10 },
11 {
12 "label": "February",
13 "value": 600
14 },
15 {
16 "label": "March",
17 "value": 700
18 }
19 ]
20 }
21}