jiajunlong commited on
Commit
481d547
·
verified ·
1 Parent(s): d56c166
Files changed (1) hide show
  1. README.md +23 -34
README.md CHANGED
@@ -1,44 +1,25 @@
1
- ---
2
- license: apache-2.0
3
- pipeline_tag: image-text-to-text
4
- ---
5
- ### TinyLLaVA
6
 
7
- We trained 1 model with fewer than 1B parameters using the TinyLLaVA approach, employing the same training settings as [TinyLLaVA](https://github.com/DLCV-BUAA/TinyLLaVABench). For the Language and Vision models, we chose [OpenELM-450M-Instruct](apple/OpenELM-450M-Instruct) and [clip-vit-base-patch16](https://huggingface.co/openai/clip-vit-base-patch16), respectively. The Connector was configured with a 2-layer MLP. The dataset used for training is the save as [LLaVA](https://github.com/haotian-liu/LLaVA). During testing, we found that [TinyLLaVA-0.55B](https://huggingface.co/jiajunlong/TinyLLaVA-0.55B) exhibited significantly faster inference speed on CPU compared to [TinyLLaVA-1.5B](https://huggingface.co/bczhou/TinyLLaVA-1.5B)
 
 
 
8
 
9
  ### Usage
10
-
11
- 1. you need to download the generate file "generate_model.py".
12
- 2. running the following command:
13
-
14
- ```bash
15
- python generate_model --model jiajunlong/TinyLLaVA-0.89B --prompt 'you want to ask' --image '/path/to/related/image'
16
- ```
17
-
18
- or execute the following test code:
19
-
20
  ```python
21
  from transformers import AutoTokenizer, AutoModelForCausalLM
22
- from generate_model import *
23
- model = AutoModelForCausalLM.from_pretrained("jiajunlong/TinyLLaVA-0.55B", trust_remote_code=True)
 
24
  config = model.config
25
- 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)
26
- prompt="you want to ask"
27
- image="/path/to/related/image"
28
- output_text, genertaion_time = generate(prompt=prompt, image=image, model=model, tokenizer=tokenizer)
29
- print_txt = (
30
- f'\r\n{"=" * os.get_terminal_size().columns}\r\n'
31
- '\033[1m Prompt + Generated Output\033[0m\r\n'
32
- f'{"-" * os.get_terminal_size().columns}\r\n'
33
- f'{output_text}\r\n'
34
- f'{"-" * os.get_terminal_size().columns}\r\n'
35
- '\r\nGeneration took'
36
- f'\033[1m\033[92m {round(genertaion_time, 2)} \033[0m'
37
- 'seconds.\r\n'
38
- )
39
- print(print_txt)
40
  ```
41
-
42
  ### Result
43
 
44
  | model_name | gqa | textvqa | sqa | vqav2 | MME | MMB | MM-VET |
@@ -46,3 +27,11 @@ print(print_txt)
46
  | [TinyLLaVA-1.5B](https://huggingface.co/bczhou/TinyLLaVA-1.5B) | 60.3 | 51.7 | 60.3 | 76.9 | 1276.5 | 55.2 | 25.8 |
47
  | [TinyLLaVA-0.55B](https://huggingface.co/jiajunlong/TinyLLaVA-0.89B) | 50.38 | 36.37 | 50.02 | 65.44 | 1056.69 | 26.29 | 15.4 |
48
 
 
 
 
 
 
 
 
 
 
1
+ **<center><span style="font-size:2em;">TinyLLaVA</span></center>**
 
 
 
 
2
 
3
+ [![arXiv](https://img.shields.io/badge/Arxiv-2402.14289-b31b1b.svg?logo=arXiv)](https://arxiv.org/abs/2402.14289)[![Github](https://img.shields.io/badge/Github-Github-blue.svg)](https://github.com/TinyLLaVA/TinyLLaVA_Factory)[![Demo](https://img.shields.io/badge/Demo-Demo-red.svg)](http://8843843nmph5.vicp.fun/#/)
4
+ TinyLLaVA has released a family of small-scale Large Multimodel Models(LMMs), ranging from 0.55B to 3.1B. Our best model, TinyLLaVA-Phi-2-SigLIP-3.1B, achieves better overall performance against existing 7B models such as LLaVA-1.5 and Qwen-VL.
5
+ ### TinyLLaVA
6
+ Here, we introduce TinyLLaVA-OpenELM-450M-SigLIP-0.55B, which is trained by the [TinyLLaVA Factory](https://github.com/TinyLLaVA/TinyLLaVA_Factory) codebase. For LLM and vision tower, we choose [OpenELM-450M-Instruct](apple/OpenELM-450M-Instruct) and [siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384), respectively. The dataset used for training this model is the [ShareGPT4V](https://github.com/InternLM/InternLM-XComposer/blob/main/projects/ShareGPT4V/docs/Data.md) dataset.
7
 
8
  ### Usage
9
+ Execute the following test code:
 
 
 
 
 
 
 
 
 
10
  ```python
11
  from transformers import AutoTokenizer, AutoModelForCausalLM
12
+ hf_path = 'jiajunlong/TinyLLaVA-OpenELM-450M-SigLIP-0.55B'
13
+ model = AutoModelForCausalLM.from_pretrained(hf_path, trust_remote_code=True)
14
+ model.cuda()
15
  config = model.config
16
+ tokenizer = AutoTokenizer.from_pretrained(hf_path, use_fast=False, model_max_length = config.tokenizer_model_max_length,padding_side = config.tokenizer_padding_side)
17
+ prompt="What are these?"
18
+ image_url="http://images.cocodataset.org/test-stuff2017/000000000001.jpg"
19
+ output_text, genertaion_time = model.chat(prompt=prompt, image=image_url, tokenizer=tokenizer)
20
+ print('model output:', output_text)
21
+ print('runing time:', genertaion_time)
 
 
 
 
 
 
 
 
 
22
  ```
 
23
  ### Result
24
 
25
  | model_name | gqa | textvqa | sqa | vqav2 | MME | MMB | MM-VET |
 
27
  | [TinyLLaVA-1.5B](https://huggingface.co/bczhou/TinyLLaVA-1.5B) | 60.3 | 51.7 | 60.3 | 76.9 | 1276.5 | 55.2 | 25.8 |
28
  | [TinyLLaVA-0.55B](https://huggingface.co/jiajunlong/TinyLLaVA-0.89B) | 50.38 | 36.37 | 50.02 | 65.44 | 1056.69 | 26.29 | 15.4 |
29
 
30
+ P.S. [TinyLLaVA Factory](https://github.com/TinyLLaVA/TinyLLaVA_Factory) is an open-source modular codebase for small-scale LMMs with a focus on simplicity of code implementations, extensibility of new features, and reproducibility of training results. This code repository provides standard training&evaluating pipelines, flexible data preprocessing&model configurations, and easily extensible architectures. Users can customize their own LMMs with minimal coding effort and less coding mistake.
31
+ TinyLLaVA Factory integrates a suite of cutting-edge models and methods.
32
+ - LLM currently supports OpenELM, TinyLlama, StableLM, Qwen, Gemma, and Phi.
33
+ - Vision tower currently supports CLIP, SigLIP, Dino, and combination of CLIP and Dino.
34
+ - Connector currently supports MLP, Qformer, and Resampler.
35
+
36
+
37
+