Usually, in LLaVA models, we generate N embeddings for the image, which we then combine with text embeddings and send to the LLM. But what if instead of creating N tokens
for one image, we create K<<N tokens for M<N parts of the image (crops)? It would allow us to get visual information from small parts of the image and not inflate the
number of image "tokens" too much. I called this method multi-crop LLaVA (MC-LLaVA).
You can read more about the model in the
blog post
.
from transformers import AutoModel, AutoProcessor
import torch
model = AutoModel.from_pretrained("visheratin/MC-LLaVA-3b", torch_dtype=torch.float16, trust_remote_code=True).to("cuda")
processor = AutoProcessor.from_pretrained("visheratin/MC-LLaVA-3b", trust_remote_code=True)
with torch.inference_mode():
inputs = processor(prompt, [raw_image], model, max_crops=100, num_tokens=728)
output = model.generate(**inputs, max_new_tokens=200, use_cache=True, do_sample=False,
eos_token_id=processor.tokenizer.eos_token_id, pad_token_id=processor.tokenizer.eos_token_id)
result = processor.tokenizer.decode(output[0]).replace(prompt, "").replace("<|im_end|>", "")
print(result)
Benchmarks
TextVQA - 50.9%
GQA - 59.5%
VQAv2 - 76.72%
VizWiz - 32.68%
V*-bench - OCR - 56.66%, GPT4V-hard - 52.94%, direct attributes - 40.86%, relative position - 56.57%
Examples
License
The model is licensed under MIT license, but since the data used for model training is largely synthetic, you should also follow OpenAI and Google Gemini terms of service.
Which means don't create competitor models for them.
Acknowledgments
Thanks to
Lambda
for providing a machine to train the model.
Thanks to
ML Collective
for continuous support and providing compute resources for testing the model.
Runs of visheratin MC-LLaVA-3b on huggingface.co
108
Total runs
0
24-hour runs
0
3-day runs
5
7-day runs
-39
30-day runs
More Information About MC-LLaVA-3b huggingface.co Model
MC-LLaVA-3b huggingface.co is an AI model on huggingface.co that provides MC-LLaVA-3b's model effect (), which can be used instantly with this visheratin MC-LLaVA-3b model. huggingface.co supports a free trial of the MC-LLaVA-3b model, and also provides paid use of the MC-LLaVA-3b. Support call MC-LLaVA-3b model through api, including Node.js, Python, http.
MC-LLaVA-3b huggingface.co is an online trial and call api platform, which integrates MC-LLaVA-3b's modeling effects, including api services, and provides a free online trial of MC-LLaVA-3b, you can try MC-LLaVA-3b online for free by clicking the link below.
visheratin MC-LLaVA-3b online free url in huggingface.co:
MC-LLaVA-3b is an open source model from GitHub that offers a free installation service, and any user can find MC-LLaVA-3b on GitHub to install. At the same time, huggingface.co provides the effect of MC-LLaVA-3b install, users can directly use MC-LLaVA-3b installed effect in huggingface.co for debugging and trial. It also supports api for free installation.