Moe LLaVA Qwen 1.8B 4e
MoE-LLaVA is a large vision-language model based on the Mixture of Experts architecture, achieving efficient multimodal learning through sparse activation parameters
Downloads 176
Release Time : 1/23/2024
Model Overview
MoE-LLaVA combines visual and language understanding capabilities, utilizing the Mixture of Experts architecture for efficient multimodal interaction while maintaining high performance with reduced parameters
Model Features
Efficient Parameter Utilization
Achieves performance comparable to 7B dense models with only 3 billion sparse activation parameters
Rapid Training
Training completed in 2 days using 8 V100 GPUs
Outstanding Performance
Surpasses larger-scale models on multiple visual understanding tasks
Model Capabilities
Visual Question Answering
Image Understanding
Multimodal Reasoning
Object Recognition
Image Caption Generation
Use Cases
Intelligent Assistant
Image Content Q&A
Answering various user questions about image content
Surpasses LLaVA-1.5-13B on object hallucination benchmarks
Content Understanding
Complex Scene Understanding
Understanding complex scene images containing multiple objects
Achieves comparable performance to LLaVA-1.5-7B on multiple visual understanding datasets
đ MoE-LLaVA: Mixture of Experts for Large Vision-Language Models
MoE-LLaVA is a large vision - language model that demonstrates excellent performance in multi - modal learning with fewer parameters.
đ Quick Start
If you're eager to explore MoE-LLaVA, you can start by trying out our web demo. We highly recommend using the following command to experience all features currently supported by MoE-LLaVA. You can also access the online demo on Huggingface Spaces.
# use phi2
deepspeed --include localhost:0 moellava/serve/gradio_web_server.py --model-path "LanguageBind/MoE-LLaVA-Phi2-2.7B-4e"
# use qwen
deepspeed --include localhost:0 moellava/serve/gradio_web_server.py --model-path "LanguageBind/MoE-LLaVA-Qwen-1.8B-4e"
# use stablelm
deepspeed --include localhost:0 moellava/serve/gradio_web_server.py --model-path "LanguageBind/MoE-LLaVA-StableLM-1.6B-4e"
⨠Features
đĨ High performance, but with fewer parameters
- With just 3B sparsely activated parameters, MoE-LLaVA demonstrates performance comparable to the LLaVA-1.5-7B on various visual understanding datasets and even surpasses the LLaVA-1.5-13B in object hallucination benchmarks.
đ Simple baseline, learning multi-modal interactions with sparse pathways.
- With the addition of a simple MoE tuning stage, we can complete the training of MoE-LLaVA on 8 V100 GPUs within 2 days.
đĻ Installation
Requirements
- Python >= 3.10
- Pytorch == 2.0.1
- CUDA Version >= 11.7
- Transformers == 4.36.2
- Tokenizers==0.15.1
Installation Steps
git clone https://github.com/PKU-YuanGroup/MoE-LLaVA
cd MoE-LLaVA
conda create -n moellava python=3.10 -y
conda activate moellava
pip install --upgrade pip # enable PEP 660 support
pip install -e .
pip install -e ".[train]"
pip install flash-attn --no-build-isolation
# Below are optional. For Qwen model.
git clone https://github.com/Dao-AILab/flash-attention
cd flash-attention && pip install .
# Below are optional. Installing them might be slow.
# pip install csrc/layer_norm
# If the version of flash-attn is higher than 2.1.1, the following is not needed.
# pip install csrc/rotary
đģ Usage Examples
Gradio Web UI
# use phi2
deepspeed --include localhost:0 moellava/serve/gradio_web_server.py --model-path "LanguageBind/MoE-LLaVA-Phi2-2.7B-4e"
# use qwen
deepspeed --include localhost:0 moellava/serve/gradio_web_server.py --model-path "LanguageBind/MoE-LLaVA-Qwen-1.8B-4e"
# use stablelm
deepspeed --include localhost:0 moellava/serve/gradio_web_server.py --model-path "LanguageBind/MoE-LLaVA-StableLM-1.6B-4e"
CLI Inference
# use phi2
deepspeed --include localhost:0 moellava/serve/cli.py --model-path "LanguageBind/MoE-LLaVA-Phi2-2.7B-4e" --image-file "image.jpg"
# use qwen
deepspeed --include localhost:0 moellava/serve/cli.py --model-path "LanguageBind/MoE-LLaVA-Qwen-1.8B-4e" --image-file "image.jpg"
# use stablelm
deepspeed --include localhost:0 moellava/serve/cli.py --model-path "LanguageBind/MoE-LLaVA-StableLM-1.6B-4e" --image-file "image.jpg"
API Usage
deepspeed predict.py
import torch
from moellava.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKEN
from moellava.conversation import conv_templates, SeparatorStyle
from moellava.model.builder import load_pretrained_model
from moellava.utils import disable_torch_init
from moellava.mm_utils import tokenizer_image_token, get_model_name_from_path, KeywordsStoppingCriteria
def main():
disable_torch_init()
image = 'moellava/serve/examples/extreme_ironing.jpg'
inp = 'What is unusual about this image?'
model_path = 'LanguageBind/MoE-LLaVA-Phi2-2.7B-4e' # LanguageBind/MoE-LLaVA-Qwen-1.8B-4e or LanguageBind/MoE-LLaVA-StableLM-1.6B-4e
device = 'cuda'
load_4bit, load_8bit = False, False # FIXME: Deepspeed support 4bit or 8bit?
model_name = get_model_name_from_path(model_path)
tokenizer, model, processor, context_len = load_pretrained_model(model_path, None, model_name, load_8bit, load_4bit, device=device)
image_processor = processor['image']
conv_mode = "phi" # qwen or stablelm
conv = conv_templates[conv_mode].copy()
roles = conv.roles
image_tensor = image_processor.preprocess(image, return_tensors='pt')['pixel_values'].to(model.device, dtype=torch.float16)
print(f"{roles[1]}: {inp}")
inp = DEFAULT_IMAGE_TOKEN + '\n' + inp
conv.append_message(conv.roles[0], inp)
conv.append_message(conv.roles[1], None)
prompt = conv.get_prompt()
input_ids = tokenizer_image_token(prompt, tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).cuda()
stop_str = conv.sep if conv.sep_style != SeparatorStyle.TWO else conv.sep2
keywords = [stop_str]
stopping_criteria = KeywordsStoppingCriteria(keywords, tokenizer, input_ids)
with torch.inference_mode():
output_ids = model.generate(
input_ids,
images=image_tensor,
do_sample=True,
temperature=0.2,
max_new_tokens=1024,
use_cache=True,
stopping_criteria=[stopping_criteria])
outputs = tokenizer.decode(output_ids[0, input_ids.shape[1]:], skip_special_tokens=True).strip()
print(outputs)
if __name__ == '__main__':
main()
đ Documentation
Training & Validating
The training & validating instruction is in TRAIN.md & EVAL.md.
Customizing your MoE-LLaVA
The instruction is in CUSTOM.md.
Visualization
The instruction is in VISUALIZATION.md.
đĻ Model Zoo
Property | Details |
---|---|
MoE-LLaVA-1.6BÃ4-Top2 | LLM: 1.6B, Checkpoint: LanguageBind/MoE-LLaVA-StableLM-1.6B-4e, Avg: 60.0, VQAv2: 76.0, GQA: 60.4, VizWiz: 37.2, SQA: 62.6, T-VQA: 47.8, POPE: 84.3, MM-Bench: 59.4, LLaVA-Bench-Wild: 85.9, MM-Vet: 26.1 |
MoE-LLaVA-1.8BÃ4-Top2 | LLM: 1.8B, Checkpoint: LanguageBind/MoE-LLaVA-Qwen-1.8B-4e, Avg: 60.2, VQAv2: 76.2, GQA: 61.5, VizWiz: 32.6, SQA: 63.1, T-VQA: 48.0, POPE: 87.0, MM-Bench: 59.6, LLaVA-Bench-Wild: 88.7, MM-Vet: 25.3 |
MoE-LLaVA-2.7BÃ4-Top2 | LLM: 2.7B, Checkpoint: LanguageBind/MoE-LLaVA-Phi2-2.7B-4e, Avg: 63.9, VQAv2: 77.1, GQA: 61.1, VizWiz: 43.4, SQA: 68.7, T-VQA: 50.2, POPE: 85.0, MM-Bench: 65.5, LLaVA-Bench-Wild: 93.2, MM-Vet: 31.1 |
đ Related Projects
- Video-LLaVA This framework empowers the model to efficiently utilize the united visual tokens.
- LanguageBind An open source five modalities language-based retrieval framework.
đ Acknowledgement
- LLaVA The codebase we built upon and it is an efficient large language and vision assistant.
đ License
- The majority of this project is released under the Apache 2.0 license as found in the LICENSE file.
- The service is a research preview intended for non-commercial use only, subject to the model License of LLaMA, Terms of Use of the data generated by OpenAI, and Privacy Practices of ShareGPT. Please contact us if you find any potential violation.
âī¸ Citation
If you find our paper and code useful in your research, please consider giving a star :star: and citation :pencil:.
@misc{lin2024moellava,
title={MoE-LLaVA: Mixture of Experts for Large Vision-Language Models},
author={Bin Lin and Zhenyu Tang and Yang Ye and Jiaxi Cui and Bin Zhu and Peng Jin and Junwu Zhang and Munan Ning and Li Yuan},
year={2024},
eprint={2401.15947},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
@article{lin2023video,
title={Video-LLaVA: Learning United Visual Representation by Alignment Before Projection},
author={Lin, Bin and Zhu, Bin and Ye, Yang and Ning, Munan and Jin, Peng and Yuan, Li},
journal={arXiv preprint arXiv:2311.10122},
year={2023}
}
⨠Star History
đ¤ Contributors
Clip Vit Large Patch14 336
A large-scale vision-language pretrained model based on the Vision Transformer architecture, supporting cross-modal understanding between images and text
Text-to-Image
Transformers

C
openai
5.9M
241
Fashion Clip
MIT
FashionCLIP is a vision-language model fine-tuned specifically for the fashion domain based on CLIP, capable of generating universal product representations.
Text-to-Image
Transformers English

F
patrickjohncyh
3.8M
222
Gemma 3 1b It
Gemma 3 is a lightweight advanced open model series launched by Google, built on the same research and technology as the Gemini models. This model is multimodal, capable of processing both text and image inputs to generate text outputs.
Text-to-Image
Transformers

G
google
2.1M
347
Blip Vqa Base
Bsd-3-clause
BLIP is a unified vision-language pretraining framework, excelling in visual question answering tasks through joint language-image training to achieve multimodal understanding and generation capabilities
Text-to-Image
Transformers

B
Salesforce
1.9M
154
CLIP ViT H 14 Laion2b S32b B79k
MIT
A vision-language model trained on the LAION-2B English dataset based on the OpenCLIP framework, supporting zero-shot image classification and cross-modal retrieval tasks
Text-to-Image
Safetensors
C
laion
1.8M
368
CLIP ViT B 32 Laion2b S34b B79k
MIT
A vision-language model trained on the English subset of LAION-2B using the OpenCLIP framework, supporting zero-shot image classification and cross-modal retrieval
Text-to-Image
Safetensors
C
laion
1.1M
112
Pickscore V1
PickScore v1 is a scoring function for text-to-image generation, used to predict human preferences, evaluate model performance, and rank images.
Text-to-Image
Transformers

P
yuvalkirstain
1.1M
44
Owlv2 Base Patch16 Ensemble
Apache-2.0
OWLv2 is a zero-shot text-conditioned object detection model that can localize objects in images through text queries.
Text-to-Image
Transformers

O
google
932.80k
99
Llama 3.2 11B Vision Instruct
Llama 3.2 is a multilingual, multimodal large language model released by Meta, supporting image-to-text and text-to-text conversion tasks with robust cross-modal understanding capabilities.
Text-to-Image
Transformers Supports Multiple Languages

L
meta-llama
784.19k
1,424
Owlvit Base Patch32
Apache-2.0
OWL-ViT is a zero-shot text-conditioned object detection model that can search for objects in images via text queries without requiring category-specific training data.
Text-to-Image
Transformers

O
google
764.95k
129
Featured Recommended AI Models
Š 2025AIbase