jiajunlong
commited on
Commit
•
35aabaa
1
Parent(s):
0ed49f5
update
Browse files
README.md
CHANGED
@@ -2,38 +2,27 @@
|
|
2 |
license: apache-2.0
|
3 |
pipeline_tag: image-text-to-text
|
4 |
---
|
5 |
-
|
6 |
|
7 |
-
|
|
|
|
|
|
|
8 |
|
9 |
### Usage
|
10 |
-
|
11 |
-
1. you need to download the generate file "generate_model.py".
|
12 |
-
2. running the following command:
|
13 |
-
```bash
|
14 |
-
python generate_model --model jiajunlong/TinyLLaVA-0.89B --prompt 'you want to ask' --image '/path/to/related/image'
|
15 |
-
```
|
16 |
-
or execute the following test code:
|
17 |
```python
|
18 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
19 |
-
|
20 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
21 |
config = model.config
|
22 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
23 |
-
prompt="
|
24 |
-
|
25 |
-
output_text, genertaion_time =
|
26 |
-
|
27 |
-
|
28 |
-
'\033[1m Prompt + Generated Output\033[0m\r\n'
|
29 |
-
f'{"-" * os.get_terminal_size().columns}\r\n'
|
30 |
-
f'{output_text}\r\n'
|
31 |
-
f'{"-" * os.get_terminal_size().columns}\r\n'
|
32 |
-
'\r\nGeneration took'
|
33 |
-
f'\033[1m\033[92m {round(genertaion_time, 2)} \033[0m'
|
34 |
-
'seconds.\r\n'
|
35 |
-
)
|
36 |
-
print(print_txt)
|
37 |
```
|
38 |
### Result
|
39 |
|
@@ -42,4 +31,9 @@ print(print_txt)
|
|
42 |
| [TinyLLaVA-1.5B](https://huggingface.co/bczhou/TinyLLaVA-1.5B) | 60.3 | 51.7 | 60.3 | 76.9 | 1276.5 | 55.2 | 25.8 |
|
43 |
| [TinyLLaVA-0.55B](https://huggingface.co/jiajunlong/TinyLLaVA-0.89B) | 53.87 | 44.02 | 54.09 | 71.74 | 1118.75 | 37.8 | 20 |
|
44 |
|
|
|
|
|
|
|
|
|
|
|
45 |
|
|
|
2 |
license: apache-2.0
|
3 |
pipeline_tag: image-text-to-text
|
4 |
---
|
5 |
+
**<center><span style="font-size:2em;">TinyLLaVA</span></center>**
|
6 |
|
7 |
+
[![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/#/)
|
8 |
+
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.
|
9 |
+
### TinyLLaVA
|
10 |
+
Here, we introduce TinyLLaVA-OpenELM-450M-SigLIP-0.89B, 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.
|
11 |
|
12 |
### Usage
|
13 |
+
Execute the following test code:
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
```python
|
15 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
16 |
+
hf_path = 'jiajunlong/TinyLLaVA-OpenELM-450M-SigLIP-0.89B'
|
17 |
+
model = AutoModelForCausalLM.from_pretrained(hf_path, trust_remote_code=True)
|
18 |
+
model.cuda()
|
19 |
config = model.config
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained(hf_path, use_fast=False, model_max_length = config.tokenizer_model_max_length,padding_side = config.tokenizer_padding_side)
|
21 |
+
prompt="What are these?"
|
22 |
+
image_url="http://images.cocodataset.org/test-stuff2017/000000000001.jpg"
|
23 |
+
output_text, genertaion_time = model.chat(prompt=prompt, image=image_url, tokenizer=tokenizer)
|
24 |
+
print('model output:', output_text)
|
25 |
+
print('runing time:', genertaion_time)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
```
|
27 |
### Result
|
28 |
|
|
|
31 |
| [TinyLLaVA-1.5B](https://huggingface.co/bczhou/TinyLLaVA-1.5B) | 60.3 | 51.7 | 60.3 | 76.9 | 1276.5 | 55.2 | 25.8 |
|
32 |
| [TinyLLaVA-0.55B](https://huggingface.co/jiajunlong/TinyLLaVA-0.89B) | 53.87 | 44.02 | 54.09 | 71.74 | 1118.75 | 37.8 | 20 |
|
33 |
|
34 |
+
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.
|
35 |
+
TinyLLaVA Factory integrates a suite of cutting-edge models and methods.
|
36 |
+
- LLM currently supports OpenELM, TinyLlama, StableLM, Qwen, Gemma, and Phi.
|
37 |
+
- Vision tower currently supports CLIP, SigLIP, Dino, and combination of CLIP and Dino.
|
38 |
+
- Connector currently supports MLP, Qformer, and Resampler.
|
39 |
|