jiajunlong commited on
Commit
e7dfeb6
1 Parent(s): f351ec3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +54 -0
README.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: image-text-to-text
4
+ ---
5
+ ### TinyLLaVA
6
+
7
+ We have released two multimodal large models smaller than 1B, and the inference speed of both models on CPU is very fast.
8
+
9
+ See the list below for the details of each model:
10
+
11
+ - [TinyLLaVA-0.55B](https://huggingface.co/jiajunlong/TinyLLaVA-0.55B)
12
+ - [TinyLLaVA-0.89B](https://huggingface.co/jiajunlong/TinyLLaVA-0.89B)
13
+
14
+ ### Usage
15
+
16
+ 1. you can download the generate file "generate_model.py"
17
+ 2. running the following command:
18
+
19
+ ```bash
20
+ python generate_model --model [MODEL_NAME] --prompt 'you want to ask' --image '/path/to/related/image'
21
+ ```
22
+
23
+ or execute the following test code:
24
+
25
+ ```python
26
+ from transformers import AutoTokenizer, AutoModelForCausalLM
27
+ from generate_model import *
28
+ model = AutoModelForCausalLM.from_pretrained("jiajunlong/TinyLLaVA-0.55B", trust_remote_code=True)
29
+ config = model.config
30
+ 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)
31
+ prompt="what is umusual about this image?"
32
+ image="joke.png"
33
+ output_text, genertaion_time = generate(prompt=prompt, image=image, model=model, tokenizer=tokenizer)
34
+ print_txt = (
35
+ f'\r\n{"=" * os.get_terminal_size().columns}\r\n'
36
+ '\033[1m Prompt + Generated Output\033[0m\r\n'
37
+ f'{"-" * os.get_terminal_size().columns}\r\n'
38
+ f'{output_text}\r\n'
39
+ f'{"-" * os.get_terminal_size().columns}\r\n'
40
+ '\r\nGeneration took'
41
+ f'\033[1m\033[92m {round(genertaion_time, 2)} \033[0m'
42
+ 'seconds.\r\n'
43
+ )
44
+ print(print_txt)
45
+ ```
46
+
47
+ ### Result
48
+
49
+ | model_name | gqa | textvqa | sqa | vqav2 | MME | MMB | MM-VET | GPU | CPU |
50
+ | :----------------------------------------------------------: | ----- | ------- | ----- | ----- | ------- | ----- | ------ | -------------- | ---------- |
51
+ | [TinyLLaVA-1.5B](https://huggingface.co/bczhou/TinyLLaVA-1.5B) | 60.3 | 51.7 | 60.3 | 76.9 | 1276.5 | 55.2 | 25.8 | 11.9 it/s | 0.35 it/s |
52
+ | [TinyLLaVA-0.55B](https://huggingface.co/jiajunlong/TinyLLaVA-0.55B) | 53.87 | 44.02 | 54.09 | 71.74 | 1118.75 | 37.8 | 20 | 11.0 it/s | 0.67 it/s |
53
+ | [TinyLLaVA-0.89B](https://huggingface.co/jiajunlong/TinyLLaVA-0.89B) | 50.38 | 36.37 | 50.02 | 65.44 | 1056.69 | 26.29 | 15.4 | **14.35 it/s** | **2 it/s** |
54
+