qnguyen3 commited on
Commit
df31b96
·
verified ·
1 Parent(s): 609a34f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -3
README.md CHANGED
@@ -1,4 +1,4 @@
1
- # nanoLLaVA
2
 
3
  <p align="center">
4
  <img src="https://i.ibb.co/W6qgZNp/pixelllava.webp" alt="Logo" width="350">
@@ -7,7 +7,16 @@
7
  ## Description
8
  nanoLLaVA is a "small but mighty" 1B vision-language model designed to run efficiently on edge devices.
9
 
 
 
 
 
 
 
 
10
  ## Usage
 
 
11
  ```python
12
  import torch
13
  import transformers
@@ -21,7 +30,7 @@ transformers.logging.disable_progress_bar()
21
  warnings.filterwarnings('ignore')
22
 
23
  # set device
24
- torch.set_default_device('cuda') # or 'cuda'
25
 
26
  # create model
27
  model = AutoModelForCausalLM.from_pretrained(
@@ -51,7 +60,7 @@ text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
51
  input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
52
 
53
  # image, sample images can be found in images folder
54
- image = Image.open('/home/qnguyen3/qnguyen3/nanoLLaVA/icon.png')
55
  image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
56
 
57
  # generate
@@ -62,4 +71,13 @@ output_ids = model.generate(
62
  use_cache=True)[0]
63
 
64
  print(tokenizer.decode(output_ids[input_ids.shape[1]:], skip_special_tokens=True).strip())
 
 
 
 
 
 
 
 
 
65
  ```
 
1
+ # nanoLLaVA - Sub 1B Vision-Language Model
2
 
3
  <p align="center">
4
  <img src="https://i.ibb.co/W6qgZNp/pixelllava.webp" alt="Logo" width="350">
 
7
  ## Description
8
  nanoLLaVA is a "small but mighty" 1B vision-language model designed to run efficiently on edge devices.
9
 
10
+ | Model | **VQA v2** | **TextVQA** | **ScienceQA** | **POPE** | **MMMU (Test)** | **MMMU (Eval)** | **GQA** | **MM-VET** |
11
+ |---------|--------|---------|-----------|------|-------------|-------------|------|--------|
12
+ | Score | 70.84 | 46.71 | 58.97 | 84.1 | 28.6 | 30.4 | 54.79| 23.9 |
13
+
14
+ ## Training Data
15
+ Training Data will be released later as I am still writing a paper on this. Expect the final final to be much more powerful than the current one.
16
+
17
  ## Usage
18
+ You can use with `transformers` with the following script:
19
+
20
  ```python
21
  import torch
22
  import transformers
 
30
  warnings.filterwarnings('ignore')
31
 
32
  # set device
33
+ torch.set_default_device('cuda') # or 'cpu'
34
 
35
  # create model
36
  model = AutoModelForCausalLM.from_pretrained(
 
60
  input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
61
 
62
  # image, sample images can be found in images folder
63
+ image = Image.open('/path/to/image.png')
64
  image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
65
 
66
  # generate
 
71
  use_cache=True)[0]
72
 
73
  print(tokenizer.decode(output_ids[input_ids.shape[1]:], skip_special_tokens=True).strip())
74
+ ```
75
+
76
+ ## Prompt Format
77
+ The model follow the ChatML standard, however, without `\n` at the end of `<|im_end|>`:
78
+ ```
79
+ <|im_start|>system
80
+ Answer the question<|im_end|><|im_start|>user
81
+ <image>
82
+ What is the picture about?<|im_end|><|im_start|>assistant
83
  ```