Instructions to use QuantFactory/falcon-7b-instruct-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use QuantFactory/falcon-7b-instruct-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/falcon-7b-instruct-GGUF", filename="falcon-7b-instruct.Q2_K.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/falcon-7b-instruct-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/falcon-7b-instruct-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/falcon-7b-instruct-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/falcon-7b-instruct-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
- Ollama
How to use QuantFactory/falcon-7b-instruct-GGUF with Ollama:
ollama run hf.co/QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/falcon-7b-instruct-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/falcon-7b-instruct-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/falcon-7b-instruct-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/falcon-7b-instruct-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/falcon-7b-instruct-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/falcon-7b-instruct-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/falcon-7b-instruct-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.falcon-7b-instruct-GGUF-Q4_K_M
List all available models
lemonade list
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: >-
|
| 13 |
+
Give me a list of the top 10 dive sites you would recommend around the
|
| 14 |
+
world.
|
| 15 |
+
example_title: Diving Top 10
|
| 16 |
+
- text: Can you tell me more about deep-water soloing?
|
| 17 |
+
example_title: Extreme sports
|
| 18 |
+
- text: >-
|
| 19 |
+
Can you write a short tweet about the Apache 2.0 release of our latest AI
|
| 20 |
+
model, Falcon LLM?
|
| 21 |
+
example_title: Twitter Helper
|
| 22 |
+
- text: What are the responsabilities of a Chief Llama Officer?
|
| 23 |
+
example_title: Trendy Jobs
|
| 24 |
+
license: apache-2.0
|
| 25 |
+
pipeline_tag: text-generation
|
| 26 |
+
base_model: tiiuae/falcon-7b-instruct
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# โจ Falcon-7B-Instruct- GGUF
|
| 30 |
+
This is quantized version of [tiiuae/falcon-7b-instruct](https://huggingface.co/tiiuae/falcon-7b-instruct) created using llama.cpp
|
| 31 |
+
|
| 32 |
+
# Model Description
|
| 33 |
+
|
| 34 |
+
**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.**
|
| 35 |
+
|
| 36 |
+
*Paper coming soon ๐.*
|
| 37 |
+
|
| 38 |
+
๐ค To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
|
| 39 |
+
|
| 40 |
+
## Why use Falcon-7B-Instruct?
|
| 41 |
+
|
| 42 |
+
* **You are looking for a ready-to-use chat/instruct model based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).**
|
| 43 |
+
* **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).
|
| 44 |
+
* **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)).
|
| 45 |
+
|
| 46 |
+
๐ฌ **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).
|
| 47 |
+
|
| 48 |
+
๐ฅ **Looking for an even more powerful model?** [Falcon-40B-Instruct](https://huggingface.co/tiiuae/falcon-40b-instruct) is Falcon-7B-Instruct's big brother!
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 52 |
+
import transformers
|
| 53 |
+
import torch
|
| 54 |
+
|
| 55 |
+
model = "tiiuae/falcon-7b-instruct"
|
| 56 |
+
|
| 57 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 58 |
+
pipeline = transformers.pipeline(
|
| 59 |
+
"text-generation",
|
| 60 |
+
model=model,
|
| 61 |
+
tokenizer=tokenizer,
|
| 62 |
+
torch_dtype=torch.bfloat16,
|
| 63 |
+
trust_remote_code=True,
|
| 64 |
+
device_map="auto",
|
| 65 |
+
)
|
| 66 |
+
sequences = pipeline(
|
| 67 |
+
"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:",
|
| 68 |
+
max_length=200,
|
| 69 |
+
do_sample=True,
|
| 70 |
+
top_k=10,
|
| 71 |
+
num_return_sequences=1,
|
| 72 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 73 |
+
)
|
| 74 |
+
for seq in sequences:
|
| 75 |
+
print(f"Result: {seq['generated_text']}")
|
| 76 |
+
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
๐ฅ **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
|
| 80 |
+
|
| 81 |
+
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).
|
| 82 |
+
|
| 83 |
+
You will need **at least 16GB of memory** to swiftly run inference with Falcon-7B-Instruct.
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# Model Card for Falcon-7B-Instruct
|
| 87 |
+
|
| 88 |
+
## Model Details
|
| 89 |
+
|
| 90 |
+
### Model Description
|
| 91 |
+
|
| 92 |
+
- **Developed by:** [https://www.tii.ae](https://www.tii.ae);
|
| 93 |
+
- **Model type:** Causal decoder-only;
|
| 94 |
+
- **Language(s) (NLP):** English and French;
|
| 95 |
+
- **License:** Apache 2.0;
|
| 96 |
+
- **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
|
| 97 |
+
|
| 98 |
+
### Model Source
|
| 99 |
+
|
| 100 |
+
- **Paper:** *coming soon*.
|
| 101 |
+
|
| 102 |
+
## Uses
|
| 103 |
+
|
| 104 |
+
### Direct Use
|
| 105 |
+
|
| 106 |
+
Falcon-7B-Instruct has been finetuned on a mixture of instruct and chat datasets.
|
| 107 |
+
|
| 108 |
+
### Out-of-Scope Use
|
| 109 |
+
|
| 110 |
+
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
|
| 111 |
+
|
| 112 |
+
## Bias, Risks, and Limitations
|
| 113 |
+
|
| 114 |
+
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.
|
| 115 |
+
|
| 116 |
+
### Recommendations
|
| 117 |
+
|
| 118 |
+
We recommend users of Falcon-7B-Instruct to develop guardrails and to take appropriate precautions for any production use.
|
| 119 |
+
|
| 120 |
+
## How to Get Started with the Model
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
```python
|
| 124 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 125 |
+
import transformers
|
| 126 |
+
import torch
|
| 127 |
+
|
| 128 |
+
model = "tiiuae/falcon-7b-instruct"
|
| 129 |
+
|
| 130 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 131 |
+
pipeline = transformers.pipeline(
|
| 132 |
+
"text-generation",
|
| 133 |
+
model=model,
|
| 134 |
+
tokenizer=tokenizer,
|
| 135 |
+
torch_dtype=torch.bfloat16,
|
| 136 |
+
trust_remote_code=True,
|
| 137 |
+
device_map="auto",
|
| 138 |
+
)
|
| 139 |
+
sequences = pipeline(
|
| 140 |
+
"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:",
|
| 141 |
+
max_length=200,
|
| 142 |
+
do_sample=True,
|
| 143 |
+
top_k=10,
|
| 144 |
+
num_return_sequences=1,
|
| 145 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 146 |
+
)
|
| 147 |
+
for seq in sequences:
|
| 148 |
+
print(f"Result: {seq['generated_text']}")
|
| 149 |
+
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
## Training Details
|
| 153 |
+
|
| 154 |
+
### Training Data
|
| 155 |
+
|
| 156 |
+
Falcon-7B-Instruct was finetuned on a 250M tokens mixture of instruct/chat datasets.
|
| 157 |
+
|
| 158 |
+
| **Data source** | **Fraction** | **Tokens** | **Description** |
|
| 159 |
+
|--------------------|--------------|------------|-----------------------------------|
|
| 160 |
+
| [Bai ze](https://github.com/project-baize/baize-chatbot) | 65% | 164M | chat |
|
| 161 |
+
| [GPT4All](https://github.com/nomic-ai/gpt4all) | 25% | 62M | instruct |
|
| 162 |
+
| [GPTeacher](https://github.com/teknium1/GPTeacher) | 5% | 11M | instruct |
|
| 163 |
+
| [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 5% | 13M | massive web crawl |
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
## Evaluation
|
| 170 |
+
|
| 171 |
+
*Paper coming soon.*
|
| 172 |
+
|
| 173 |
+
See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
|
| 174 |
+
|
| 175 |
+
Note that this model variant is not optimized for NLP benchmarks.
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
## Technical Specifications
|
| 179 |
+
|
| 180 |
+
For more information about pretraining, see [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
|
| 181 |
+
|
| 182 |
+
### Model Architecture and Objective
|
| 183 |
+
|
| 184 |
+
Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
|
| 185 |
+
|
| 186 |
+
The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
|
| 187 |
+
|
| 188 |
+
* **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
|
| 189 |
+
* **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
|
| 190 |
+
* **Decoder-block:** parallel attention/MLP with a single layer norm.
|
| 191 |
+
|
| 192 |
+
| **Hyperparameter** | **Value** | **Comment** |
|
| 193 |
+
|--------------------|-----------|----------------------------------------|
|
| 194 |
+
| Layers | 32 | |
|
| 195 |
+
| `d_model` | 4544 | Increased to compensate for multiquery |
|
| 196 |
+
| `head_dim` | 64 | Reduced to optimise for FlashAttention |
|
| 197 |
+
| Vocabulary | 65024 | |
|
| 198 |
+
| Sequence length | 2048 | |
|
| 199 |
+
|
| 200 |
+
### Compute Infrastructure
|
| 201 |
+
|
| 202 |
+
#### Hardware
|
| 203 |
+
|
| 204 |
+
Falcon-7B-Instruct was trained on AWS SageMaker, on 32 A100 40GB GPUs in P4d instances.
|
| 205 |
+
|
| 206 |
+
#### Software
|
| 207 |
+
|
| 208 |
+
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.)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
## Modle Citation
|
| 212 |
+
|
| 213 |
+
*Paper coming soon* ๐. In the meanwhile, you can use the following information to cite:
|
| 214 |
+
```
|
| 215 |
+
@article{falcon40b,
|
| 216 |
+
title={{Falcon-40B}: an open large language model with state-of-the-art performance},
|
| 217 |
+
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},
|
| 218 |
+
year={2023}
|
| 219 |
+
}
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
To learn more about the pretraining dataset, see the ๐ [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
|
| 223 |
+
|
| 224 |
+
```
|
| 225 |
+
@article{refinedweb,
|
| 226 |
+
title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
|
| 227 |
+
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},
|
| 228 |
+
journal={arXiv preprint arXiv:2306.01116},
|
| 229 |
+
eprint={2306.01116},
|
| 230 |
+
eprinttype = {arXiv},
|
| 231 |
+
url={https://arxiv.org/abs/2306.01116},
|
| 232 |
+
year={2023}
|
| 233 |
+
}
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
## Model License
|
| 238 |
+
|
| 239 |
+
Falcon-7B-Instruct is made available under the Apache 2.0 license.
|
| 240 |
+
|
| 241 |
+
## Model Contact
|
| 242 |
+
falconllm@tii.ae
|