tinyllava commited on
Commit
3fe88c6
1 Parent(s): a35eb58

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -0
README.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: image-text-to-text
4
+ ---
5
+
6
+ ### TinyLLaVA
7
+
8
+ We trained a TinyLLaVA model with 3.1B parameters, employing the same training settings as [TinyLLaVA](https://github.com/DLCV-BUAA/TinyLLaVABench). For the Language and Vision models, we chose [Phi-2](microsoft/phi-2) and [siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384), respectively. The Connector was configured with a 2-layer MLP. The dataset used for training is the [ShareGPT4V](https://github.com/InternLM/InternLM-XComposer/blob/main/projects/ShareGPT4V/docs/Data.md) dataset.
9
+
10
+ ### Usage
11
+
12
+ 1. you need to download the generate file "generate_model.py".
13
+ 2. running the following command:
14
+ ```bash
15
+ python generate_model --model tinyllava/TinyLLaVA-Phi-2-SigLIP-3.1B --prompt 'you want to ask' --image '/path/to/related/image'
16
+ ```
17
+ or execute the following test code:
18
+ ```python
19
+ from transformers import AutoTokenizer, AutoModelForCausalLM
20
+ from generate_model import *
21
+ model = AutoModelForCausalLM.from_pretrained("tinyllava/TinyLLaVA-Phi-2-SigLIP-3.1B", trust_remote_code=True)
22
+ config = model.config
23
+ tokenizer = AutoTokenizer.from_pretrained("tinyllava/TinyLLaVA-Phi-2-SigLIP-3.1B", use_fast=False, model_max_length = config.tokenizer_model_max_length,padding_side = config.tokenizer_padding_side)
24
+ prompt="you want to ask"
25
+ image="/path/to/related/image"
26
+ output_text, genertaion_time = generate(prompt=prompt, image=image, model=model, tokenizer=tokenizer)
27
+ print_txt = (
28
+ f'\r\n{"=" * os.get_terminal_size().columns}\r\n'
29
+ '\033[1m Prompt + Generated Output\033[0m\r\n'
30
+ f'{"-" * os.get_terminal_size().columns}\r\n'
31
+ f'{output_text}\r\n'
32
+ f'{"-" * os.get_terminal_size().columns}\r\n'
33
+ '\r\nGeneration took'
34
+ f'\033[1m\033[92m {round(genertaion_time, 2)} \033[0m'
35
+ 'seconds.\r\n'
36
+ )
37
+ print(print_txt)
38
+ ```
39
+ ### Result
40
+
41
+ | model_name | vqav2 | gqa | sqa | textvqa | MM-VET | POPE | MME | MMMU |
42
+ | :----------------------------------------------------------: | ----- | ------- | ----- | ----- | ------- | ----- | ------ |
43
+ | [bczhou/TinyLLaVA-3.1B](https://huggingface.co/bczhou/TinyLLaVA-3.1B) | 79.9 | 62.0 | 69.1 | 59.1 | 32.0 | 86.4 | 1464.98 | - |
44
+ | [tinyllava/TinyLLaVA-Phi-2-SigLIP-3.1B](https://huggingface.co/tinyllava/TinyLLaVA-Phi-2-SigLIP-3.1B) | 80.1 | 62.1 | 73.0 | 60.3 | 37.5 | 87.2 | 1466.4 | 38.4 |