File size: 6,096 Bytes
6e9a459 f954da5 6e9a459 7cb82f1 6e9a459 7cb82f1 6e9a459 6e547d4 6e9a459 |
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 |
---
datasets:
- NeelNanda/pile-10k
base_model:
- tiiuae/Falcon3-10B-Base
---
## Model Details
This model is an int4 model with group_size 128 and symmetric quantization of [Falcon3-10B-Base](https://huggingface.co/tiiuae/Falcon3-10B-Base) generated by [intel/auto-round](https://github.com/intel/auto-round).
## How To Use
### INT4 Inference(CPU/HPU/CUDA)
```python
from auto_round import AutoRoundConfig ##must import for auto_round format
from transformers import AutoModelForCausalLM, AutoTokenizer
quantized_model_dir = "OPEA/falcon3-10B-int4-sym-inc"
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
model = AutoModelForCausalLM.from_pretrained(
quantized_model_dir,
device_map="auto",
)
text = "How many r in strawberry? The answer is "
inputs = tokenizer(text, return_tensors="pt", return_token_type_ids=False).to(model.device)
print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50)[0]))
text = "How many r in strawberry? The answer is"
##INT4:
"""How many r in strawberry? The answer is 2.
### Additional Questions and Answers
#### 11. **How many r in strawberry?**
**Answer:**
The word "strawberry" contains 2 'r's.
####
"""
##BF16:
"""
How many r in strawberry? The ansnwer is 2.
### 10. **How many r in strawberry?**
**Question:** How many times does the letter 'r' appear in the word "strawberry"?
**Answer:** The letter 'r
**Answer:**
The answer to the riddle"""
"""
text = "Which number is larger, 9.8 or 9.11? The answer is"
##INT4
"""Which number is larger, 9.8 or 9.11? The answer is 9.8.
#### 10. **What is the smallest number in the set {1.2, 1.02, 1.22, 1.002}?**
"""
##BF16:
"""Which number is larger, 9.8 or 9.11? The answer is 9.8.
#### Question 2:
**How do you compare the numbers 12.34 and 12.345?**
**Answer:**
To compare 12.34"""
text = "Once upon a time,"
##INT4:
"""Once upon a time, in a small town named Harmonyville, lived two best friends - Mia and Ben. They were both eight years old and loved exploring the world around them. One sunny afternoon, while playing near the park, they found a mysterious box with a note
"""
##BF16:
"""Once upon a time, in a small town named Harmonyville, there lived two best friends - Timmy the Turtle and Sally the Squirrel. They loved exploring their beautiful forest home together, discovering new things every day. One sunny afternoon, they stumbled upon a mysterious cave filled with
"""
text = "There is a girl who likes adventure,"
##INT4:
"""There is a girl who likes adventure, and she loves to explore new places. One day, she decided to go on a trip to a faraway land called "The Land of the Sun." She packed her bag with everything she needed, including her favorite book about the sun.
"""
##BF16:
"""There is a girl who likes adventure, and she loves to explore new places. One day, she decided to go on a trip to a beautiful country called Italy. She wanted to see all the famous landmarks and try the delicious Italian food.
"""
```
### Evaluate the model
pip3 install lm-eval==0.4.5
```bash
auto-round --model "OPEA/falcon3-10B-int4-sym-inc" --eval --eval_bs 16 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,arc_easy,arc_challenge,mmlu
```
| Metric | BF16 | INT4 |
| ------------------------- | ----------------- | ----------------- |
| Avg.13 | 0.6151 | 0.6092 |
| Avg.10 | 0.64113 | 0.63584 |
| leaderboard_mmlu_pro | 0.4238 | 0.4156 |
| leaderboard_ifeval | (0.4149+0.2939)/2 | (0.4233+0.2828)/2 |
| gsm8k(5shot) strict match | 0.8067 | 0.7923 |
| mmlu | 0.7069 | 0.6930 |
| lambada_openai | 0.6998 | 0.7025 |
| hellaswag | 0.5873 | 0.5832 |
| winogrande | 0.7380 | 0.7293 |
| piqa | 0.7884 | 0.7889 |
| truthfulqa_mc1 | 0.3427 | 0.3452 |
| openbookqa | 0.3400 | 0.3320 |
| boolq | 0.8232 | 0.8116 |
| arc_easy | 0.8312 | 0.8258 |
| arc_challenge | 0.5538 | 0.5469 |
### Generate the model
Here is the sample command to generate the model.
```bash
auto-round \
--model tiiuae/Falcon3-10B-Base \
--device 0 \
--group_size 128 \
--nsamples 512 \
--bits 4 \
--iter 1000 \
--disable_eval \
--model_dtype 'float16' \
--format 'auto_awq,auto_gptq,auto_round' \
--output_dir "./tmp_autoround"
```
## Ethical Considerations and Limitations
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
Therefore, before deploying any applications of the model, developers should perform safety testing.
## Caveats and Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
Here are a couple of useful links to learn more about Intel's AI software:
- Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
## 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 consult an attorney before using this model for commercial purposes.
## Cite
@article{cheng2023optimize, title={Optimize weight rounding via signed gradient descent for the quantization of llms}, author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }
[arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round) |