File size: 9,379 Bytes
d583797 15bac08 235845f 6cc9404 ba781a8 6cc9404 d583797 40ba213 f80d294 e790d61 421c10f e790d61 500f621 f62a11e 500f621 ba781a8 aa3a590 ba781a8 270a834 ba781a8 08617fa ba781a8 270a834 ba781a8 ead09bf 270a834 ba781a8 914cef7 ba781a8 a288383 ba781a8 914cef7 ba781a8 a288383 ba781a8 914cef7 ba781a8 a288383 ba781a8 270a834 ba781a8 270a834 a288383 270a834 d79f1b0 270a834 ba781a8 40ba213 44c03f7 270a834 44c03f7 15bac08 |
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
---
license: other
license_name: falcon-license
library_name: peft
tags:
- falcon
datasets:
- ehartford/dolphin
- garage-bAInd/Open-Platypus
inference: false
pipeline_tag: text-generation
base_model: tiiuae/falcon-180B
---
<div align="center">
<img src="./falcon.webp" width="150px">
</div>
# Falcon-180B-Instruct-v0.1
This instruction model was built via parameter-efficient QLoRA finetuning of [falcon-180b](https://huggingface.co/tiiuae/falcon-180B) on the first 5k rows of [ehartford/dolphin](https://huggingface.co/datasets/ehartford/dolphin) and the first 5k rows of [garage-bAInd/Open-Platypus](https://huggingface.co/datasets/garage-bAInd/Open-Platypus). Finetuning was executed on 4x A6000s (48 GB RTX) for roughly 32 hours on the [Lambda Labs](https://cloud.lambdalabs.com/instances) platform.
## Benchmark metrics
| Metric | Value |
|-----------------------|-------|
| MMLU (5-shot) | Coming |
| ARC (25-shot) | Coming |
| HellaSwag (10-shot) | Coming |
| TruthfulQA (0-shot) | Coming |
| Avg. | Coming |
We use Eleuther.AI's [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) to run the benchmark tests below, the same version as Hugging Face's [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
## Helpful links
* Model license: [Falcon-180B TII License](https://huggingface.co/spaces/tiiuae/falcon-180b-license/blob/main/LICENSE.txt)
## Loss curve
![loss curve](https://raw.githubusercontent.com/daniel-furman/sft-demos/main/assets/sep_12_23_9_20_00_log_loss_curves_falcon-180b-instruct.png)
The above loss curve was generated from the run's private wandb.ai log.
## Example prompts and responses
Example 1:
**User**:
> Write me a numbered list of things to do in New York City.
**Falcon-180B-Instruct-v0.1**:
> 1. Visit the Empire State Building: Take in the breathtaking views of the city from the observation deck on the 86th floor.
>
> 2. Stroll through Central Park: Enjoy the lush greenery, lakes, and various attractions in this iconic urban park.
>
> 3. Explore the Metropolitan Museum of Art: Admire the vast collection of art from around the world, spanning thousands of years.
>
> 4. See a Broadway show: Experience the magic of live theater in one of the world's most famous theater districts.
>
> 5. Walk across the Brooklyn Bridge: Take in the stunning views of the Manhattan skyline and the East River as you cross this iconic bridge.
>
> 6. Visit the Statue of Liberty: Take a ferry to Liberty Island and climb to the top of the statue for a unique perspective of the city.
>
> 7. Visit the 9/11 Memorial and Museum: Pay tribute to the victims of the September 11th attacks and learn about the events that changed the world.
>
> 8. Visit Times Square: Experience the bright lights and bustling energy of this iconic intersection.
>
> 9. Visit the High Line: Stroll along this elevated park, built on a former railroad track, and ...
<br>
Example 2:
**User**:
> Write a short email inviting my friends to a dinner party on Friday. Respond succinctly.
**Falcon-180B-Instruct-v0.1**:
> Subject: Dinner Party Invitation - Friday, 7pm
>
> Dear friends,
>
> I would like to invite you to a dinner party at my place this Friday at 7pm. It would be a great opportunity to catch up and enjoy some delicious food together.
>
> Please let me know if you can make it by Wednesday. I look forward to seeing you all!
>
> Best,
> [Your Name]
>
> P.S. Please let me know if you have any dietary restrictions.
<br>
Example 3:
**User**:
> Tell me a recipe for vegan banana bread.
**Falcon-180B-Instruct-v0.1**:
> Ingredients:
> - 3 ripe bananas
> - 1/3 cup melted coconut oil or vegan butter
> - 1/4 cup non-dairy milk (almond, soy, or oat milk)
> - 1 teaspoon vanilla extract
> - 1/2 cup brown sugar
> - 1 1/2 cups all-purpose flour
> - 1 teaspoon baking powder
> - 1/2 teaspoon baking soda
> - 1/2 teaspoon salt
> - 1/2 teaspoon ground cinnamon (optional)
> - 1/2 cup chopped walnuts or chocolate chips (optional)
>
> Instructions:
>
> 1. Preheat your oven to 350°F (175°C). Grease a 9x5-inch loaf pan with vegan butter or coconut oil.
>
> 2. In a large mixing bowl, mash the ripe bananas with a fork until they are smooth.
>
> 3. Add the melted coconut oil or vegan butter, non-dairy milk, vanilla extract, and brown sugar to the mashed bananas. Mix well until combined.
>
> 4. In a separate bowl, whisk together the all-purpose flour, baking powder, baking soda, salt, and ground cinnamon (if using).
>
> 5. Gradually add the dry ingredients to the wet ingredients, mixing until just combined. Do not overmix.
>
> 6. If you're using walnuts or chocolate chips, gently fold them into the batter.
>
> 7. Pour the batter into the prepared loaf pan and smooth the top with a spatula.
>
> 8. Bake for 45-55 minutes, or until a toothpick inserted into the center of the loaf comes out clean.
>
> 9. Allow the banana bread to cool in the pan for 10 minutes before transferring it to a wire rack to cool completely.
>
> 10. Slice and serve warm or at room temperature. Enjoy!
>
> Note: You can also use whole wheat flour or a gluten-free flour blend in place of all-purpose flour. Adjust the baking time accordingly, as whole wheat flour or gluten-free flour may require a longer baking time.
>
> Optional variations:
> - Add 1/2 cup of chopped nuts (walnuts, pecans, or almonds) or chocolate chips to the batter for extra flavor and texture.
<br>
## Limitations and biases
_The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
This model can produce factually incorrect output, and should not be relied on to produce factually accurate information.
This model was trained on various public datasets.
While great efforts have been taken to clean the pretraining data, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
## Basic usage
```python
!pip install -q -U huggingface_hub peft transformers torch accelerate
```
```python
from huggingface_hub import notebook_login
import torch
from peft import PeftModel, PeftConfig
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig,
pipeline,
)
notebook_login()
```
```python
peft_model_id = "dfurman/Falcon-180B-Instruct-v0.1"
config = PeftConfig.from_pretrained(peft_model_id)
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
)
model = AutoModelForCausalLM.from_pretrained(
config.base_model_name_or_path,
quantization_config=bnb_config,
use_auth_token=True,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path, use_fast=True)
tokenizer.pad_token = tokenizer.eos_token
model = PeftModel.from_pretrained(model, peft_model_id)
format_template = "You are a helpful assistant. Write a response that appropriately completes the request. {query}\n"
```
```python
# First, format the prompt
query = "Tell me a recipe for vegan banana bread."
prompt = format_template.format(query=query)
# Inference can be done using model.generate
print("\n\n*** Generate:")
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.cuda()
with torch.autocast("cuda", dtype=torch.bfloat16):
output = model.generate(
input_ids=input_ids,
max_new_tokens=512,
do_sample=True,
temperature=0.7,
return_dict_in_generate=True,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
repetition_penalty=1.2,
)
print(tokenizer.decode(output["sequences"][0], skip_special_tokens=True))
```
## Runtime tests
| runtime / 50 tokens (sec) | GPU | attn | torch dtype | VRAM (GB) |
|:-----------------------------:|:----------------------:|:---------------------:|:-------------:|:-----------------------:|
| 27.15 | 4x A6000s (48 GB RTX) | torch | nf4 | 140 |
## Acknowledgements
This model was finetuned by Daniel Furman on Sep 10, 2023 and is for research applications only.
## Disclaimer
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please cosult an attorney before using this model for commercial purposes.
## tiiuae/falcon-180B citation
```
@article{falcon,
title={The Falcon Series of Language Models: Towards Open Frontier Models},
author={Almazrouei, Ebtesam and Alobeidli, Hamza and Alshamsi, Abdulaziz and Cappelli, Alessandro and Cojocaru, Ruxandra and Alhammadi, Maitha and Daniele, Mazzotta and Heslow, Daniel and Launay, Julien and Malartic, Quentin and Noune, Badreddine and Pannier, Baptiste and Penedo, Guilherme},
year={2023}
}
```
## Training procedure
The following `bitsandbytes` quantization config was used during training:
- quant_method: bitsandbytes
- load_in_8bit: False
- load_in_4bit: True
- llm_int8_threshold: 6.0
- llm_int8_skip_modules: None
- llm_int8_enable_fp32_cpu_offload: False
- llm_int8_has_fp16_weight: False
- bnb_4bit_quant_type: nf4
- bnb_4bit_use_double_quant: False
- bnb_4bit_compute_dtype: bfloat16
## Framework versions
- PEFT 0.6.0.dev0 |