Sharathhebbar24
commited on
Commit
•
5f1d57c
1
Parent(s):
00bca43
Update README.md
Browse files
README.md
CHANGED
@@ -1,201 +1,228 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
|
|
|
7 |
|
8 |
-
|
9 |
|
|
|
10 |
|
|
|
11 |
|
12 |
-
##
|
13 |
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
-
## Uses
|
37 |
|
38 |
-
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
|
48 |
-
|
49 |
|
50 |
-
|
51 |
|
52 |
### Out-of-Scope Use
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
|
58 |
## Bias, Risks, and Limitations
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
|
64 |
### Recommendations
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
|
70 |
## How to Get Started with the Model
|
71 |
|
72 |
-
Use the code below to get started with the model.
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
## Training Details
|
77 |
|
78 |
### Training Data
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
-
#### Training Hyperparameters
|
94 |
|
95 |
-
|
96 |
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
|
103 |
## Evaluation
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
|
113 |
-
[
|
114 |
|
115 |
-
|
116 |
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
|
119 |
-
|
120 |
|
121 |
-
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
|
147 |
-
-
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
|
153 |
-
|
154 |
|
155 |
-
|
|
|
|
|
156 |
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
### Compute Infrastructure
|
160 |
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
#### Hardware
|
164 |
|
165 |
-
|
166 |
|
167 |
#### Software
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
|
187 |
-
[More Information Needed]
|
188 |
|
189 |
-
##
|
190 |
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
-
|
194 |
|
195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
|
197 |
-
## Model Card Contact
|
198 |
|
199 |
-
|
200 |
|
|
|
201 |
|
|
|
|
|
|
1 |
---
|
2 |
+
datasets:
|
3 |
+
- tiiuae/falcon-refinedweb
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
inference: true
|
7 |
+
widget:
|
8 |
+
- text: "Hey Falcon! Any recommendations for my holidays in Abu Dhabi?"
|
9 |
+
example_title: "Abu Dhabi Trip"
|
10 |
+
- text: "What's the Everett interpretation of quantum mechanics?"
|
11 |
+
example_title: "Q/A: Quantum & Answers"
|
12 |
+
- text: "Give me a list of the top 10 dive sites you would recommend around the world."
|
13 |
+
example_title: "Diving Top 10"
|
14 |
+
- text: "Can you tell me more about deep-water soloing?"
|
15 |
+
example_title: "Extreme sports"
|
16 |
+
- text: "Can you write a short tweet about the Apache 2.0 release of our latest AI model, Falcon LLM?"
|
17 |
+
example_title: "Twitter Helper"
|
18 |
+
- text: "What are the responsabilities of a Chief Llama Officer?"
|
19 |
+
example_title: "Trendy Jobs"
|
20 |
+
license: apache-2.0
|
21 |
---
|
22 |
|
23 |
+
This is a Sharded version of [tiiuae/falcon-7b-instruct](https://huggingface.co/tiiuae/falcon-7b-instruct) which takes 3GB RAM to load where as the original model takes around 16GB RAM.
|
24 |
+
# ✨ Falcon-7B-Instruct
|
25 |
|
26 |
+
**Falcon-7B-Instruct is a 7B parameters causal decoder-only model built by [TII](https://www.tii.ae) based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) and finetuned on a mixture of chat/instruct datasets. It is made available under the Apache 2.0 license.**
|
27 |
|
28 |
+
*Paper coming soon 😊.*
|
29 |
|
30 |
+
🤗 To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
|
31 |
|
32 |
+
## Why use Falcon-7B-Instruct?
|
33 |
|
34 |
+
* **You are looking for a ready-to-use chat/instruct model based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).**
|
35 |
+
* **Falcon-7B is a strong base model, outperforming comparable open-source models** (e.g., [MPT-7B](https://huggingface.co/mosaicml/mpt-7b), [StableLM](https://github.com/Stability-AI/StableLM), [RedPajama](https://huggingface.co/togethercomputer/RedPajama-INCITE-Base-7B-v0.1) etc.), thanks to being trained on 1,500B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) enhanced with curated corpora. See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
|
36 |
+
* **It features an architecture optimized for inference**, with FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135)) and multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)).
|
37 |
|
38 |
+
💬 **This is an instruct model, which may not be ideal for further finetuning.** If you are interested in building your own instruct/chat model, we recommend starting from [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
|
39 |
|
40 |
+
🔥 **Looking for an even more powerful model?** [Falcon-40B-Instruct](https://huggingface.co/tiiuae/falcon-40b-instruct) is Falcon-7B-Instruct's big brother!
|
41 |
|
42 |
+
```python
|
43 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
44 |
+
import transformers
|
45 |
+
import torch
|
46 |
+
model = "tiiuae/falcon-7b-instruct"
|
47 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
48 |
+
pipeline = transformers.pipeline(
|
49 |
+
"text-generation",
|
50 |
+
model=model,
|
51 |
+
tokenizer=tokenizer,
|
52 |
+
torch_dtype=torch.bfloat16,
|
53 |
+
trust_remote_code=True,
|
54 |
+
device_map="auto",
|
55 |
+
)
|
56 |
+
sequences = pipeline(
|
57 |
+
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
|
58 |
+
max_length=200,
|
59 |
+
do_sample=True,
|
60 |
+
top_k=10,
|
61 |
+
num_return_sequences=1,
|
62 |
+
eos_token_id=tokenizer.eos_token_id,
|
63 |
+
)
|
64 |
+
for seq in sequences:
|
65 |
+
print(f"Result: {seq['generated_text']}")
|
66 |
+
```
|
67 |
|
68 |
+
💥 **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
|
69 |
|
70 |
+
For fast inference with Falcon, check-out [Text Generation Inference](https://github.com/huggingface/text-generation-inference)! Read more in this [blogpost]((https://huggingface.co/blog/falcon).
|
71 |
|
72 |
+
You will need **at least 16GB of memory** to swiftly run inference with Falcon-7B-Instruct.
|
|
|
|
|
73 |
|
|
|
74 |
|
75 |
+
# Model Card for Falcon-7B-Instruct
|
76 |
|
77 |
+
## Model Details
|
78 |
+
|
79 |
+
### Model Description
|
80 |
+
|
81 |
+
- **Developed by:** [https://www.tii.ae](https://www.tii.ae);
|
82 |
+
- **Model type:** Causal decoder-only;
|
83 |
+
- **Language(s) (NLP):** English and French;
|
84 |
+
- **License:** Apache 2.0;
|
85 |
+
- **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
|
86 |
|
87 |
+
### Model Source
|
88 |
|
89 |
+
- **Paper:** *coming soon*.
|
90 |
|
91 |
+
## Uses
|
92 |
|
93 |
+
### Direct Use
|
94 |
|
95 |
+
Falcon-7B-Instruct has been finetuned on a mixture of instruct and chat datasets.
|
96 |
|
97 |
### Out-of-Scope Use
|
98 |
|
99 |
+
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
|
|
|
|
|
100 |
|
101 |
## Bias, Risks, and Limitations
|
102 |
|
103 |
+
Falcon-7B-Instruct is mostly trained on English data, and will not generalize appropriately to other languages. Furthermore, as it is trained on a large-scale corpora representative of the web, it will carry the stereotypes and biases commonly encountered online.
|
|
|
|
|
104 |
|
105 |
### Recommendations
|
106 |
|
107 |
+
We recommend users of Falcon-7B-Instruct to develop guardrails and to take appropriate precautions for any production use.
|
|
|
|
|
108 |
|
109 |
## How to Get Started with the Model
|
110 |
|
|
|
111 |
|
112 |
+
```python
|
113 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
114 |
+
import transformers
|
115 |
+
import torch
|
116 |
+
model = "tiiuae/falcon-7b-instruct"
|
117 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
118 |
+
pipeline = transformers.pipeline(
|
119 |
+
"text-generation",
|
120 |
+
model=model,
|
121 |
+
tokenizer=tokenizer,
|
122 |
+
torch_dtype=torch.bfloat16,
|
123 |
+
trust_remote_code=True,
|
124 |
+
device_map="auto",
|
125 |
+
)
|
126 |
+
sequences = pipeline(
|
127 |
+
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
|
128 |
+
max_length=200,
|
129 |
+
do_sample=True,
|
130 |
+
top_k=10,
|
131 |
+
num_return_sequences=1,
|
132 |
+
eos_token_id=tokenizer.eos_token_id,
|
133 |
+
)
|
134 |
+
for seq in sequences:
|
135 |
+
print(f"Result: {seq['generated_text']}")
|
136 |
+
```
|
137 |
|
138 |
## Training Details
|
139 |
|
140 |
### Training Data
|
141 |
|
142 |
+
Falcon-7B-Instruct was finetuned on a 250M tokens mixture of instruct/chat datasets.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
+
| **Data source** | **Fraction** | **Tokens** | **Description** |
|
145 |
+
|--------------------|--------------|------------|-----------------------------------|
|
146 |
+
| [Bai ze](https://github.com/project-baize/baize-chatbot) | 65% | 164M | chat |
|
147 |
+
| [GPT4All](https://github.com/nomic-ai/gpt4all) | 25% | 62M | instruct |
|
148 |
+
| [GPTeacher](https://github.com/teknium1/GPTeacher) | 5% | 11M | instruct |
|
149 |
+
| [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 5% | 13M | massive web crawl |
|
150 |
|
|
|
151 |
|
152 |
+
The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
|
153 |
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
## Evaluation
|
156 |
|
157 |
+
*Paper coming soon.*
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
+
See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
|
160 |
|
161 |
+
Note that this model variant is not optimized for NLP benchmarks.
|
162 |
|
|
|
163 |
|
164 |
+
## Technical Specifications
|
165 |
|
166 |
+
For more information about pretraining, see [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
|
167 |
|
168 |
+
### Model Architecture and Objective
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
+
Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
|
|
|
|
|
|
|
|
|
171 |
|
172 |
+
The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
|
173 |
|
174 |
+
* **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
|
175 |
+
* **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
|
176 |
+
* **Decoder-block:** parallel attention/MLP with a single layer norm.
|
177 |
|
178 |
+
| **Hyperparameter** | **Value** | **Comment** |
|
179 |
+
|--------------------|-----------|----------------------------------------|
|
180 |
+
| Layers | 32 | |
|
181 |
+
| `d_model` | 4544 | Increased to compensate for multiquery |
|
182 |
+
| `head_dim` | 64 | Reduced to optimise for FlashAttention |
|
183 |
+
| Vocabulary | 65024 | |
|
184 |
+
| Sequence length | 2048 | |
|
185 |
|
186 |
### Compute Infrastructure
|
187 |
|
|
|
|
|
188 |
#### Hardware
|
189 |
|
190 |
+
Falcon-7B-Instruct was trained on AWS SageMaker, on 32 A100 40GB GPUs in P4d instances.
|
191 |
|
192 |
#### Software
|
193 |
|
194 |
+
Falcon-7B-Instruct was trained a custom distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO and high-performance Triton kernels (FlashAttention, etc.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
|
|
|
196 |
|
197 |
+
## Citation
|
198 |
|
199 |
+
*Paper coming soon* 😊. In the meanwhile, you can use the following information to cite:
|
200 |
+
```
|
201 |
+
@article{falcon40b,
|
202 |
+
title={{Falcon-40B}: an open large language model with state-of-the-art performance},
|
203 |
+
author={Almazrouei, Ebtesam and Alobeidli, Hamza and Alshamsi, Abdulaziz and Cappelli, Alessandro and Cojocaru, Ruxandra and Debbah, Merouane and Goffinet, Etienne and Heslow, Daniel and Launay, Julien and Malartic, Quentin and Noune, Badreddine and Pannier, Baptiste and Penedo, Guilherme},
|
204 |
+
year={2023}
|
205 |
+
}
|
206 |
+
```
|
207 |
|
208 |
+
To learn more about the pretraining dataset, see the 📓 [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
|
209 |
|
210 |
+
```
|
211 |
+
@article{refinedweb,
|
212 |
+
title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
|
213 |
+
author={Guilherme Penedo and Quentin Malartic and Daniel Hesslow and Ruxandra Cojocaru and Alessandro Cappelli and Hamza Alobeidli and Baptiste Pannier and Ebtesam Almazrouei and Julien Launay},
|
214 |
+
journal={arXiv preprint arXiv:2306.01116},
|
215 |
+
eprint={2306.01116},
|
216 |
+
eprinttype = {arXiv},
|
217 |
+
url={https://arxiv.org/abs/2306.01116},
|
218 |
+
year={2023}
|
219 |
+
}
|
220 |
+
```
|
221 |
|
|
|
222 |
|
223 |
+
## License
|
224 |
|
225 |
+
Falcon-7B-Instruct is made available under the Apache 2.0 license.
|
226 |
|
227 |
+
## Contact
|
228 |