Satyam-Singh
commited on
Commit
•
d215d95
1
Parent(s):
1a25f83
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,126 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- fr
|
5 |
+
- it
|
6 |
+
- de
|
7 |
+
- es
|
8 |
+
- en
|
9 |
+
- hi
|
10 |
+
- pa
|
11 |
+
- ta
|
12 |
+
- te
|
13 |
+
- mr
|
14 |
+
- be
|
15 |
+
- ba
|
16 |
+
- bn
|
17 |
+
- ru
|
18 |
+
- ee
|
19 |
+
- am
|
20 |
+
- ar
|
21 |
+
- qu
|
22 |
+
- ja
|
23 |
+
- ch
|
24 |
+
- kw
|
25 |
---
|
26 |
+
# Model Card for LLaVa-8x7B
|
27 |
+
The LLaVa-8x7B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts. The LLaVa-8x7B outperforms Llama 2 70B on most benchmarks we tested.
|
28 |
+
|
29 |
+
|
30 |
+
## Warning
|
31 |
+
This repo contains weights that are compatible with [vLLM](https://github.com/vllm-project/vllm) serving of the model as well as Hugging Face [transformers](https://github.com/huggingface/transformers) library. It is based on the original LLaVa [torrent release](magnet:?xt=urn:btih:5546272da9065eddeb6fcd7ffddeef5b75be79a7&dn=mixtral-8x7b-32kseqlen&tr=udp%3A%2F%http://2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=http%3A%2F%http://2Ftracker.openbittorrent.com%3A80%2Fannounce), but the file format and parameter names are different. Please note that model cannot (yet) be instantiated with HF.
|
32 |
+
|
33 |
+
## Run the model
|
34 |
+
|
35 |
+
|
36 |
+
```python
|
37 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
38 |
+
|
39 |
+
model_id = "Satyam-Singh/LLava-8x7B-v0.1"
|
40 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
41 |
+
|
42 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
43 |
+
|
44 |
+
text = "Hello my name is"
|
45 |
+
inputs = tokenizer(text, return_tensors="pt")
|
46 |
+
|
47 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
48 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
49 |
+
```
|
50 |
+
|
51 |
+
By default, transformers will load the model in full precision. Therefore you might be interested to further reduce down the memory requirements to run the model through the optimizations we offer in HF ecosystem:
|
52 |
+
|
53 |
+
### In half-precision
|
54 |
+
|
55 |
+
Note `float16` precision only works on GPU devices
|
56 |
+
|
57 |
+
<details>
|
58 |
+
<summary> Click to expand </summary>
|
59 |
+
|
60 |
+
```diff
|
61 |
+
+ import torch
|
62 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
63 |
+
|
64 |
+
model_id = "Satyam-Singh/LLava-8x7B-v0.1"
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
66 |
+
|
67 |
+
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).to(0)
|
68 |
+
|
69 |
+
text = "Hello my name is"
|
70 |
+
+ inputs = tokenizer(text, return_tensors="pt").to(0)
|
71 |
+
|
72 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
73 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
74 |
+
```
|
75 |
+
</details>
|
76 |
+
|
77 |
+
### Lower precision using (8-bit & 4-bit) using `bitsandbytes`
|
78 |
+
|
79 |
+
<details>
|
80 |
+
<summary> Click to expand </summary>
|
81 |
+
|
82 |
+
```diff
|
83 |
+
+ import torch
|
84 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
85 |
+
|
86 |
+
model_id = "Satyam-Singh/LLava-8x7B-v0.1"
|
87 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
88 |
+
|
89 |
+
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
|
90 |
+
|
91 |
+
text = "Hello my name is"
|
92 |
+
+ inputs = tokenizer(text, return_tensors="pt").to(0)
|
93 |
+
|
94 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
95 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
96 |
+
```
|
97 |
+
</details>
|
98 |
+
|
99 |
+
### Load the model with Flash Attention 2
|
100 |
+
|
101 |
+
<details>
|
102 |
+
<summary> Click to expand </summary>
|
103 |
+
|
104 |
+
```diff
|
105 |
+
+ import torch
|
106 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
107 |
+
|
108 |
+
model_id = "Satyam-Singh/LLava-8x7B-v0.1"
|
109 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
110 |
+
|
111 |
+
+ model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True)
|
112 |
+
|
113 |
+
text = "Hello my name is"
|
114 |
+
+ inputs = tokenizer(text, return_tensors="pt").to(0)
|
115 |
+
|
116 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
117 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
118 |
+
```
|
119 |
+
</details>
|
120 |
+
|
121 |
+
## Notice
|
122 |
+
LLava-8x7B-v0.1 is a pretrained base model and therefore does not have any moderation mechanisms.
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
# Love From The LLaVa AI & UniVerse Unique AI Team
|