Edit model card

TinyLLaVA

We trained 1 model with fewer than 1B parameters using the TinyLLaVA approach, employing the same training settings as TinyLLaVA. For the Language and Vision models, we chose OpenELM-450M-Instruct and clip-vit-base-patch16, respectively. The Connector was configured with a 2-layer MLP. The dataset used for training is the save as LLaVA. During testing, we found that TinyLLaVA-0.55B exhibited significantly faster inference speed on CPU compared to TinyLLaVA-1.5B

Usage

  1. you need to download the generate file "generate_model.py".
  2. running the following command:
python generate_model --model jiajunlong/TinyLLaVA-0.89B --prompt 'you want to ask' --image '/path/to/related/image'

or execute the following test code:

from transformers import AutoTokenizer, AutoModelForCausalLM
from generate_model import *
model = AutoModelForCausalLM.from_pretrained("jiajunlong/TinyLLaVA-0.55B", trust_remote_code=True)
config = model.config
tokenizer = AutoTokenizer.from_pretrained("jiajunlong/TinyLLaVA-0.55B", use_fast=False, model_max_length = config.tokenizer_model_max_length,padding_side = config.tokenizer_padding_side)
prompt="you want to ask"
image="/path/to/related/image"
output_text, genertaion_time = generate(prompt=prompt, image=image, model=model, tokenizer=tokenizer)
print_txt = (
        f'\r\n{"=" * os.get_terminal_size().columns}\r\n'
        '\033[1m Prompt + Generated Output\033[0m\r\n'
        f'{"-" * os.get_terminal_size().columns}\r\n'
        f'{output_text}\r\n'
        f'{"-" * os.get_terminal_size().columns}\r\n'
        '\r\nGeneration took'
        f'\033[1m\033[92m {round(genertaion_time, 2)} \033[0m'
        'seconds.\r\n'
    )
print(print_txt)

Result

model_name gqa textvqa sqa vqav2 MME MMB MM-VET
TinyLLaVA-1.5B 60.3 51.7 60.3 76.9 1276.5 55.2 25.8
TinyLLaVA-0.55B 50.38 36.37 50.02 65.44 1056.69 26.29 15.4
Downloads last month
103
Safetensors
Model size
547M params
Tensor type
FP16
·
Inference API (serverless) does not yet support model repos that contain custom code.