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