Home

Awesome

Awaker

Awaker is a series of multimodal large models developed by Metabrain AGI,including multimodal large language model (MLLM) Awaker-VL, multimodal retrieval model Awaker-Sou, and video generation model Awaker-Gen.

News

Performance

MME-RealWorld-CN Benchmark

ModelsParametersInstitutionsOverallPerceptionReasoning
Awaker2.5-VL (ours)10.8BMetabrain AGI62.767.7152.07
Qwen2-VL8BAlibaba55.559.8046.46
InternVL-27BShanghai AI Lab54.357.9746.65
InternVL-Chat-V1.520BShanghai AI Lab47.949.9043.74
Claude 3.5 Sonnet-Anthropic47.048.2544.31
YI-VL-34B34B01.AI42.042.4541.16
CogVLM2-llama3-Chat8BTHU & Zhipu AI39.838.5742.25
GPT-4o-OpenAI38.843.4429.05
Mini-Gemini-34B-HD34BCUHK38.538.3138.75
Cambrian-1-8B8BNYU33.632.4435.97
LLaVA-NeXT-Qwen-72B72BBytedance30.630.0231.67
Gemini-1.5-Pro-Google28.136.1011.14
DeepSeek-VL7BDeepSeek-AI27.627.6327.63
GPT-4o-mini-OpenAI25.926.3225.16

MME-RealWorld Benchmark

ModelsParametersInstitutionsOverallPerceptionReasoning
Awaker2.5-VL (ours)10.8BMetabrain AGI60.863.1443.74
LLaVA-OneVision8BBytedance57.459.5941.17
Qwen2-VL8BAlibaba56.558.9640.39
InternVL-27BShanghai AI Lab53.555.8238.74
Claude 3.5 Sonnet-Anthropic51.652.9044.12
InternVL-Chat-V1.520BShanghai AI Lab49.451.3636.48
Mini-Gemini-34B-HD34BCUHK45.948.0531.73
GPT-4o-OpenAI45.246.4337.61
CogVLM2-llama3-Chat8BTHU & Zhipu AI44.645.8437.25
Cambrian-1-8B8BNYU42.743.8236.16
Gemini-1.5-Pro-Google38.239.6329.19
GPT-4o-mini-OpenAI36.437.1232.48
DeepSeek-VL7BDeepSeek-AI32.433.1427.98
YI-VL-34B34B01.AI31.030.9732.45
LLaVA-NeXT-Qwen-72B72BBytedance28.729.0127.86

MMBench-CN Benchmark

ModelsParametersInstitutionsOverallMMBench_v1.1MMBench
Qwen2-VL-72B73.4BAlibaba86.385.886.7
InternVL2-40B40BShanghai AI Lab85.784.986.4
InternVL2-Llama-76B76BShanghai AI Lab85.585.5-
Taiyi-Megvii85.285.085.4
JT-VL-Chat-V3.0-China Mobile84.783.585.8
LLaVA-OneVision-72B73BByteDance84.683.985.3
Step-1.5V-StepFun84.083.584.5
Claude3.5-Sonnet-20241022-Anthropic83.082.583.5
Awaker2.5-VL (ours)10.8BMetabrain AGI82.681.883.4
GPT-4o (0513, detail-low)-OpenAI82.382.582.1
LLaVA-OneVision-7B8BByteDance81.880.982.7
GPT-4o (0513, detail-high)-OpenAI81.881.582.1
InternVL2-26B26BShanghai AI Lab81.580.982.1
CongROng-CloudWalk81.280.481.9
MMAlaya226BDataCanvas80.979.782.1
Ovis1.6-Gemma2-9B10.2BAlibaba80.879.582.0
Qwen2-VL-7B8BAlibaba80.580.380.6
LLaVA-OneVision-72B (SI)73BByteDance80.081.978.0
InternVL-Chat-V1.526BShanghai AI Lab79.979.180.7
InternLM-XComposer2.58BShanghai AI Lab79.978.880.9
GPT-4o (0806, detail-high)-OpenAI79.879.280.3
GPT-4V (0409, detail-high)-OpenAI79.278.280.2

MMBench Benchmark

ModelsParametersInstitutionsOverallMMBench_v1.1MMBench
Qwen2-VL-72B73.4BAlibaba86.586.186.9
InternVL2-40B40BShanghai AI Lab86.085.186.8
Taiyi-Megvii85.784.786.7
InternVL2-Llama-76B76BShanghai AI Lab85.585.5-
LLaVA-OneVision-72B73BByteDance85.485.085.8
JT-VL-Chat-V3.0-China Mobile84.583.685.4
Awaker2.5-VL (ours)10.8BMetabrain AGI83.782.584.9
GPT-4o (0513, detail-high)-OpenAI83.283.083.4
GPT-4o (0513, detail-low)-OpenAI83.283.183.3
Step-1.5V-StepFun82.980.485.3
InternVL2-26B26BShanghai AI Lab82.581.583.4
Ovis1.6-Gemma2-9B10.2BAlibaba82.581.583.4
RBDash-v1.2-72B79BDLUT82.581.783.2
Qwen2-VL-7B8BAlibaba82.481.883.0
LLaVA-OneVision-7B8BByteDance82.180.983.2
GPT-4o (0806, detail-high)-OpenAI82.081.882.1
LLaVA-OneVision-72B (SI)73BByteDance81.983.380.5
Qwen-VL-Plus-0809-Alibaba81.981.182.7
CongROng-CloudWalk81.980.982.8
Claude3.5-Sonnet-20241022-Anthropic81.880.982.6
MMAlaya226BDataCanvas81.680.682.5
InternVL-Chat-V1.526BShanghai AI Lab81.380.382.3
InternLM-XComposer2.58BShanghai AI Lab81.180.182.0
GPT-4V (0409, detail-high)-OpenAI80.580.081.0

Environment Requirements

  1. Clone this repository and navigate to Awaker folder.
git clone https://github.com/MetabrainAGI/Awaker.git
cd Awaker/Awaker2.5-VL
  1. Install Package.
# Install specific transformers
cd transformers
pip install -e .
cd ..
# Install specific peft
pip install peft==0.6.0
cp -r peft /path/to/envs/site-packages/
# Install qwen-vl-utils
pip install qwen-vl-utils[decord]
  1. Version of torch
torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0

Quickstart

You need to download the model weights of Awaker2.5-VL (the pytorch_model.bin file) from MetabrainAGI/Awaker2.5-VL.

Here we present a code snippet to show how to use the chat model:

import torch
from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info
from peft import MoeConfig, get_peft_model

def find_n_position(target_list, target_value, n):
    count = 0
    for i, element in enumerate(target_list):
        if element == target_value:
            count += 1
            if count == n:
                return i
        
    return -1

# Load the base Qwen2-VL model
model = Qwen2VLForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2-VL-7B-Instruct", torch_dtype="auto", device_map="auto"
)

# Load the Awaker2.5-VL model
target_modules_for_lora = ["q_proj", "k_proj","v_proj"]
target_modules_for_moe = ["o_proj", "gate_proj", "up_proj", "down_proj"]
num_experts = 4
g_enable = True
lora_config = MoeConfig(
    r=256,
    lora_alpha=512,
    target_modules=target_modules_for_lora,
    lora_dropout=0.05,
    task_type="CAUSAL_LM",
    modules_to_save=None,
)
moe_config = MoeConfig(
    r=256,
    lora_alpha=512,
    target_modules=target_modules_for_moe,
    lora_dropout=0.05,
    task_type="CAUSAL_LM",
    modules_to_save=None,
    multiple_loras=True,
    g_enable=g_enable,
    noise_std=0.1,
    gates_tmp=1.0,
    topk=1,
    num_experts=num_experts,
    loss_coef=0,
    token=False,
    freeze_gate=True,
)
model = get_peft_model(model, lora_config, adapter_name='default')
for i in range(num_experts):
    model.add_adapter(str(i), moe_config)
if g_enable:
    model.add_adapter("g", moe_config)
    
# Load the weights of Awaker2.5-VL    
ckpt = torch.load("/path/to/Awaker2.5-VL/pytorch_model.bin")
model.load_state_dict(ckpt, strict=True)
model.to("cuda")
model.eval()

# default processer
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")

# The default range for the number of visual tokens per image in the model is 4-16384.
# You can set min_pixels and max_pixels according to your needs, such as a token range of 256-1280, to balance performance and cost.
# min_pixels = 256*28*28
# max_pixels = 1280*28*28
# processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", min_pixels=min_pixels, max_pixels=max_pixels)

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "image",
                "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
            },
            {"type": "text", "text": "Describe this image."},
        ],
    }
]

# Preparation for inference
text = processor.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
    text=[text],
    images=image_inputs,
    videos=video_inputs,
    padding=True,
    return_tensors="pt",
)

vision_start_id = 151652
vision_end_id = 151653
im_start_id = 151644
im_end_id = 151645
prompt_pos = [[0,0]]
input_ids = inputs["input_ids"][0].tolist()
if image_inputs:
    start_pos = input_ids.index(vision_start_id)
else:
    start_pos = find_n_position(input_ids, im_start_id, 2) + 2
end_pos = find_n_position(input_ids, im_end_id, 2)
assert end_pos != -1, "end_pos error!"
assert start_pos != -1,  "start_pos error!"
prompt_pos[0][0] = start_pos
prompt_pos[0][1] = end_pos
inputs["prompt_pos"] = torch.tensor(prompt_pos)
inputs = inputs.to("cuda")

# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=512)
generated_ids_trimmed = [
    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text[0])

Citation

If you find our work helpful for your research, please consider citing the following BibTeX entry.

@article{awaker2.5-vl,
    title     = {{Awaker2.5-VL}: Stably Scaling MLLMs with Parameter-Efficient Mixture of Experts},
    author    = {Jinqiang Long and Yanqi Dai and Guoxing Yang and Hongpeng Lin and Nanyi Fei and Yizhao Gao and Zhiwu Lu},    
    journal   = {arXiv preprint arXiv:2411.10669},
    year      = {2024} 
}