Downloads · 30 days
8
6% of all-time downloads
sxj1215/mixlora-qwen2vl-19datasets
mixlora-qwen2vl-19datasets is a image-text-to-text model from sxj1215. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This model is a MixLoRA (Mixture of LoRA) adaptation of Qwen2-VL-7B, trained on 19 diverse multimodal datasets using continuous learning with label-based expert routing.
Downloads · 30 days
8
6% of all-time downloads
All-time downloads
135
Public
Repo size
34.6 GB
Likes
0
Public
Click a slice to open those files.
.bin34.3 GB · 99%
From the Hugging Face model README
This model is a MixLoRA (Mixture of LoRA) adaptation of Qwen2-VL-7B, trained on 19 diverse multimodal datasets using continuous learning with label-based expert routing.
The model was trained continuously on 19 multimodal datasets, grouped into three categories:
✅ 8 LoRA Experts: Mixture of 8 specialized experts, selecting 2 per forward pass ✅ Label-Based Routing: Automatic expert selection based on dataset category ✅ Continuous Learning: Sequential training preserving knowledge across datasets ✅ Grayscale Image Support: Handles RGB, grayscale, and black/white images ✅ Multi-Task: Trained on VQA, captioning, classification, and reasoning tasks
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoProcessor
from peft import PeftModel
import torch
# Load base model
base_model_name = "Qwen/Qwen2-VL-7B"
base_model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
# Load LoRA adapters
model = PeftModel.from_pretrained(base_model, "sxj1215/mixlora-qwen2vl-19datasets")
# Load processor and tokenizer
processor = AutoProcessor.from_pretrained(base_model_name, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("sxj1215/mixlora-qwen2vl-19datasets")
from PIL import Image
from qwen_vl_utils import process_vision_info
# Load image
image = Image.open("example.jpg")
# Prepare input
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "Describe this image in detail."}
]
}
]
# Process
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"
).to(model.device)
# Generate
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=False
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Qwen2-VL-7B (Base)
├── Vision Encoder: CLIP-ViT-Large-336
├── MLP Projector: 2-layer with GELU
└── Language Model: Qwen2-7B with 8 LoRA Experts
├── Expert 0, 1: Uni tasks (7 datasets)
├── Expert 3, 4: Syn tasks (6 datasets)
└── Expert 6, 7: Red tasks (6 datasets)
Expert Selection: Based on dataset label (Uni/Syn/Red), automatically routes to appropriate expert pair.
This ensures:
8 critical bugs were fixed during development:
See training repository for full bug documentation.
The model demonstrates strong performance across diverse multimodal tasks:
Specific benchmark scores coming soon
If you use this model, please cite the original MixLoRA paper:
@article{shen2024multimodal,
title={Multimodal Instruction Tuning with Conditional Mixture of LoRA},
author={Shen, Ying and Xu, Zhiyang and Wang, Qifan and Cheng, Yu and Yin, Wenpeng and Huang, Lifu},
journal={arXiv preprint arXiv:2402.15896},
year={2024}
}
And the Qwen2-VL paper:
@article{qwen2vl,
title={Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution},
author={Qwen Team},
journal={arXiv preprint},
year={2024}
}
This model inherits the license from Qwen2-VL-7B. The LoRA adapters are released under Apache 2.0.
sxj1215