Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,141 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- multilingual
|
4 |
+
|
5 |
+
license: apache-2.0
|
6 |
+
---
|
7 |
+
|
8 |
+
# Model Card for FLAN-T5 large
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
# Table of Contents
|
13 |
+
|
14 |
+
0. [TL;DR](#TL;DR)
|
15 |
+
1. [Model Details](#model-details)
|
16 |
+
2. [Usage](#usage)
|
17 |
+
3. [Training Details](#training-details)
|
18 |
+
4. [Evaluation](#evaluation)
|
19 |
+
|
20 |
+
|
21 |
+
# TL;DR
|
22 |
+
|
23 |
+
# Model Details
|
24 |
+
|
25 |
+
## Model Description
|
26 |
+
|
27 |
+
|
28 |
+
- **Model type:** Language model
|
29 |
+
- **Language(s) (NLP):** English
|
30 |
+
- **License:** Apache 2.0
|
31 |
+
|
32 |
+
# Usage
|
33 |
+
|
34 |
+
Find below some example scripts on how to use the model in `transformers` (Make sure to have the latest transformers, or the one built from source):
|
35 |
+
|
36 |
+
## Using the Pytorch model
|
37 |
+
|
38 |
+
### Running the model on a CPU
|
39 |
+
|
40 |
+
<details>
|
41 |
+
<summary> Click to expand </summary>
|
42 |
+
|
43 |
+
```python
|
44 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
45 |
+
|
46 |
+
tokenizer = AutoTokenizer.from_pretrained("tiiuae/sindibad-7b")
|
47 |
+
model = AutoModelForCausalLM.from_pretrained("tiiuae/sindibad-7b")
|
48 |
+
|
49 |
+
input_text = "Question: How many hours in one day? Answer: "
|
50 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
51 |
+
|
52 |
+
outputs = model.generate(input_ids)
|
53 |
+
print(tokenizer.decode(outputs[0]))
|
54 |
+
```
|
55 |
+
|
56 |
+
</details>
|
57 |
+
|
58 |
+
### Running the model on a GPU
|
59 |
+
|
60 |
+
<details>
|
61 |
+
<summary> Click to expand </summary>
|
62 |
+
|
63 |
+
```python
|
64 |
+
# pip install accelerate
|
65 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
66 |
+
|
67 |
+
tokenizer = AutoTokenizer.from_pretrained("tiiuae/sindibad-7b")
|
68 |
+
model = AutoModelForCausalLM.from_pretrained("tiiuae/sindibad-7b", device_map="auto")
|
69 |
+
|
70 |
+
input_text = "Question: How many hours in one day? Answer: "
|
71 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
|
72 |
+
|
73 |
+
outputs = model.generate(input_ids)
|
74 |
+
print(tokenizer.decode(outputs[0]))
|
75 |
+
```
|
76 |
+
|
77 |
+
</details>
|
78 |
+
|
79 |
+
### Running the model on a GPU using different precisions
|
80 |
+
|
81 |
+
#### FP16
|
82 |
+
|
83 |
+
<details>
|
84 |
+
<summary> Click to expand </summary>
|
85 |
+
|
86 |
+
```python
|
87 |
+
# pip install accelerate
|
88 |
+
import torch
|
89 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
90 |
+
|
91 |
+
tokenizer = AutoTokenizer.from_pretrained("tiiuae/sindibad-7b")
|
92 |
+
model = AutoModelForCausalLM.from_pretrained("tiiuae/sindibad-7b", device_map="auto", torch_dtype=torch.float16)
|
93 |
+
|
94 |
+
input_text = "Question: How many hours in one day? Answer: "
|
95 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
|
96 |
+
|
97 |
+
outputs = model.generate(input_ids)
|
98 |
+
print(tokenizer.decode(outputs[0]))
|
99 |
+
```
|
100 |
+
|
101 |
+
</details>
|
102 |
+
|
103 |
+
#### INT8
|
104 |
+
|
105 |
+
<details>
|
106 |
+
<summary> Click to expand </summary>
|
107 |
+
|
108 |
+
```python
|
109 |
+
# pip install bitsandbytes accelerate
|
110 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
111 |
+
|
112 |
+
tokenizer = AutoTokenizer.from_pretrained("tiiuae/sindibad-7b")
|
113 |
+
model = AutoModelForCausalLM.from_pretrained("tiiuae/sindibad-7b", device_map="auto", load_in_8bit=True)
|
114 |
+
|
115 |
+
input_text = "Question: How many hours in one day? Answer: "
|
116 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
|
117 |
+
|
118 |
+
outputs = model.generate(input_ids)
|
119 |
+
print(tokenizer.decode(outputs[0]))
|
120 |
+
```
|
121 |
+
|
122 |
+
</details>
|
123 |
+
|
124 |
+
|
125 |
+
# Training Details
|
126 |
+
|
127 |
+
## Training Data
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
## Training Procedure
|
132 |
+
|
133 |
+
|
134 |
+
# Evaluation
|
135 |
+
|
136 |
+
## Testing Data, Factors & Metrics
|
137 |
+
|
138 |
+
|
139 |
+
## Results
|
140 |
+
|
141 |
+
|