--- 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 ---
# 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 ...
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.
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.
## 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