OPEA
/

Safetensors
llama
4-bit precision
awq
cicdatopea's picture
Update README.md
f954da5 verified
metadata
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 generated by intel/auto-round.

How To Use

INT4 Inference(CPU/HPU/CUDA)

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

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.

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

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 github