Views
No views yet
1from auto_round import AutoRoundConfig ##must import for auto_round format
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4quantized_model_dir = "OPEA/falcon3-10B-int4-sym-inc"
5tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
6model = AutoModelForCausalLM.from_pretrained(
7 quantized_model_dir,
8 device_map="auto",
9)
10text = "How many r in strawberry? The answer is "
11inputs = tokenizer(text, return_tensors="pt", return_token_type_ids=False).to(model.device)
12print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50)[0]))
13
14text = "How many r in strawberry? The answer is"
15##INT4:
16"""How many r in strawberry? The answer is 2.
17
18### Additional Questions and Answers
19
20#### 11. **How many r in strawberry?**
21**Answer:**
22The word "strawberry" contains 2 'r's.
23
24####
25"""
26
27##BF16:
28"""
29How many r in strawberry? The ansnwer is 2.
30
31### 10. **How many r in strawberry?**
32**Question:** How many times does the letter 'r' appear in the word "strawberry"?
33**Answer:** The letter 'r
34
35**Answer:**
36The answer to the riddle"""
37"""
38
39text = "Which number is larger, 9.8 or 9.11? The answer is"
40##INT4
41"""Which number is larger, 9.8 or 9.11? The answer is 9.8.
42
43#### 10. **What is the smallest number in the set {1.2, 1.02, 1.22, 1.002}?**
44"""
45##BF16:
46"""Which number is larger, 9.8 or 9.11? The answer is 9.8.
47
48#### Question 2:
49**How do you compare the numbers 12.34 and 12.345?**
50
51**Answer:**
52To compare 12.34"""
53
54
55text = "Once upon a time,"
56##INT4:
57"""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
58"""
59
60##BF16:
61"""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
62"""
63
64text = "There is a girl who likes adventure,"
65##INT4:
66"""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.
67"""
68
69##BF16:
70"""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.
71"""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 |
1auto-round \
2--model tiiuae/Falcon3-10B-Base \
3--device 0 \
4--group_size 128 \
5--nsamples 512 \
6--bits 4 \
7--iter 1000 \
8--disable_eval \
9--model_dtype 'float16' \
10--format 'auto_awq,auto_gptq,auto_round' \
11--output_dir "./tmp_autoround"