update
Browse files
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 |
-
|
|
|
|
|
|
|
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 |
-
|
23 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
24 |
config = model.config
|
25 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
26 |
-
prompt="
|
27 |
-
|
28 |
-
output_text, genertaion_time =
|
29 |
-
|
30 |
-
|
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 |
+
[](https://arxiv.org/abs/2402.14289)[](https://github.com/TinyLLaVA/TinyLLaVA_Factory)[](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 |
+
|