Files changed (3) hide show
  1. README.md +14 -211
  2. adapter_config.json +19 -0
  3. adapter_model.bin +3 -0
README.md CHANGED
@@ -1,217 +1,20 @@
1
  ---
2
- datasets:
3
- - tiiuae/falcon-refinedweb
4
- language:
5
- - en
6
- inference: true
7
- license: apache-2.0
8
  ---
 
9
 
10
- # Resharded
11
 
12
- Resharded version of https://huggingface.co/tiiuae/falcon-7b-instruct for low RAM enviroments (e.g. Colab, Kaggle) in safetensors
 
 
 
 
 
 
 
 
 
 
13
 
14
- Tutorial: https://medium.com/@vilsonrodrigues/run-your-private-llm-falcon-7b-instruct-with-less-than-6gb-of-gpu-using-4-bit-quantization-ff1d4ffbabcc
15
 
16
- ---
17
-
18
-
19
- # ✨ Falcon-7B-Instruct
20
-
21
- **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.**
22
-
23
- *Paper coming soon 😊.*
24
-
25
- ## Why use Falcon-7B-Instruct?
26
-
27
- * **You are looking for a ready-to-use chat/instruct model based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).**
28
- * **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).
29
- * **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)).
30
-
31
- 💬 **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).
32
-
33
- 🔥 **Looking for an even more powerful model?** [Falcon-40B-Instruct](https://huggingface.co/tiiuae/falcon-40b-instruct) is Falcon-7B-Instruct's big brother!
34
-
35
- ```python
36
- from transformers import AutoTokenizer, AutoModelForCausalLM
37
- import transformers
38
- import torch
39
- model = "tiiuae/falcon-7b-instruct"
40
- tokenizer = AutoTokenizer.from_pretrained(model)
41
- pipeline = transformers.pipeline(
42
- "text-generation",
43
- model=model,
44
- tokenizer=tokenizer,
45
- torch_dtype=torch.bfloat16,
46
- trust_remote_code=True,
47
- device_map="auto",
48
- )
49
- sequences = pipeline(
50
- "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:",
51
- max_length=200,
52
- do_sample=True,
53
- top_k=10,
54
- num_return_sequences=1,
55
- eos_token_id=tokenizer.eos_token_id,
56
- )
57
- for seq in sequences:
58
- print(f"Result: {seq['generated_text']}")
59
- ```
60
-
61
- 💥 **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
62
-
63
-
64
- # Model Card for Falcon-7B-Instruct
65
-
66
- ## Model Details
67
-
68
- ### Model Description
69
-
70
- - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
71
- - **Model type:** Causal decoder-only;
72
- - **Language(s) (NLP):** English and French;
73
- - **License:** Apache 2.0;
74
- - **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
75
-
76
- ### Model Source
77
-
78
- - **Paper:** *coming soon*.
79
-
80
- ## Uses
81
-
82
- ### Direct Use
83
-
84
- Falcon-7B-Instruct has been finetuned on a mixture of instruct and chat datasets.
85
-
86
- ### Out-of-Scope Use
87
-
88
- Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
89
-
90
- ## Bias, Risks, and Limitations
91
-
92
- 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.
93
-
94
- ### Recommendations
95
-
96
- We recommend users of Falcon-7B-Instruct to develop guardrails and to take appropriate precautions for any production use.
97
-
98
- ## How to Get Started with the Model
99
-
100
-
101
- ```python
102
- from transformers import AutoTokenizer, AutoModelForCausalLM
103
- import transformers
104
- import torch
105
- model = "tiiuae/falcon-7b-instruct"
106
- tokenizer = AutoTokenizer.from_pretrained(model)
107
- pipeline = transformers.pipeline(
108
- "text-generation",
109
- model=model,
110
- tokenizer=tokenizer,
111
- torch_dtype=torch.bfloat16,
112
- trust_remote_code=True,
113
- device_map="auto",
114
- )
115
- sequences = pipeline(
116
- "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:",
117
- max_length=200,
118
- do_sample=True,
119
- top_k=10,
120
- num_return_sequences=1,
121
- eos_token_id=tokenizer.eos_token_id,
122
- )
123
- for seq in sequences:
124
- print(f"Result: {seq['generated_text']}")
125
- ```
126
-
127
- ## Training Details
128
-
129
- ### Training Data
130
-
131
- Falcon-7B-Instruct was finetuned on a 250M tokens mixture of instruct/chat datasets.
132
-
133
- | **Data source** | **Fraction** | **Tokens** | **Description** |
134
- |--------------------|--------------|------------|-----------------------------------|
135
- | [Bai ze](https://github.com/project-baize/baize-chatbot) | 65% | 164M | chat |
136
- | [GPT4All](https://github.com/nomic-ai/gpt4all) | 25% | 62M | instruct |
137
- | [GPTeacher](https://github.com/teknium1/GPTeacher) | 5% | 11M | instruct |
138
- | [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 5% | 13M | massive web crawl |
139
-
140
-
141
- The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
142
-
143
-
144
- ## Evaluation
145
-
146
- *Paper coming soon.*
147
-
148
- See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
149
-
150
- Note that this model variant is not optimized for NLP benchmarks.
151
-
152
-
153
- ## Technical Specifications
154
-
155
- For more information about pretraining, see [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
156
-
157
- ### Model Architecture and Objective
158
-
159
- Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
160
-
161
- The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
162
-
163
- * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
164
- * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
165
- * **Decoder-block:** parallel attention/MLP with a single layer norm.
166
-
167
- | **Hyperparameter** | **Value** | **Comment** |
168
- |--------------------|-----------|----------------------------------------|
169
- | Layers | 32 | |
170
- | `d_model` | 4544 | Increased to compensate for multiquery |
171
- | `head_dim` | 64 | Reduced to optimise for FlashAttention |
172
- | Vocabulary | 65024 | |
173
- | Sequence length | 2048 | |
174
-
175
- ### Compute Infrastructure
176
-
177
- #### Hardware
178
-
179
- Falcon-7B-Instruct was trained on AWS SageMaker, on 32 A100 40GB GPUs in P4d instances.
180
-
181
- #### Software
182
-
183
- 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.)
184
-
185
-
186
- ## Citation
187
-
188
- *Paper coming soon* 😊. In the meanwhile, you can use the following information to cite:
189
- ```
190
- @article{falcon40b,
191
- title={{Falcon-40B}: an open large language model with state-of-the-art performance},
192
- 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},
193
- year={2023}
194
- }
195
- ```
196
-
197
- To learn more about the pretraining dataset, see the 📓 [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
198
-
199
- ```
200
- @article{refinedweb,
201
- title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
202
- 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},
203
- journal={arXiv preprint arXiv:2306.01116},
204
- eprint={2306.01116},
205
- eprinttype = {arXiv},
206
- url={https://arxiv.org/abs/2306.01116},
207
- year={2023}
208
- }
209
- ```
210
-
211
-
212
- ## License
213
-
214
- Falcon-7B-Instruct is made available under the Apache 2.0 license.
215
-
216
- ## Contact
217
- falconllm@tii.ae
 
1
  ---
2
+ library_name: peft
 
 
 
 
 
3
  ---
4
+ ## Training procedure
5
 
 
6
 
7
+ The following `bitsandbytes` quantization config was used during training:
8
+ - load_in_8bit: False
9
+ - load_in_4bit: True
10
+ - llm_int8_threshold: 6.0
11
+ - llm_int8_skip_modules: None
12
+ - llm_int8_enable_fp32_cpu_offload: False
13
+ - llm_int8_has_fp16_weight: False
14
+ - bnb_4bit_quant_type: nf4
15
+ - bnb_4bit_use_double_quant: True
16
+ - bnb_4bit_compute_dtype: bfloat16
17
+ ### Framework versions
18
 
 
19
 
20
+ - PEFT 0.4.0.dev0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adapter_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model_name_or_path": "vilsonrodrigues/falcon-7b-instruct-sharded",
3
+ "bias": "none",
4
+ "fan_in_fan_out": false,
5
+ "inference_mode": true,
6
+ "init_lora_weights": true,
7
+ "layers_pattern": null,
8
+ "layers_to_transform": null,
9
+ "lora_alpha": 32,
10
+ "lora_dropout": 0.05,
11
+ "modules_to_save": null,
12
+ "peft_type": "LORA",
13
+ "r": 16,
14
+ "revision": null,
15
+ "target_modules": [
16
+ "query_key_value"
17
+ ],
18
+ "task_type": "CAUSAL_LM"
19
+ }
adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2542606d142cec278245f8642a16af7f057bf5ee5bbd713f5d1775adc84a5a7b
3
+ size 18898161