Views
No views yet
1##pip install auto-gptq==0.7.1
2from transformers import AutoModelForCausalLM,AutoTokenizer
3quantized_model_dir = "Intel/Qwen2-1.5B-Insturct-int4-inc"
4tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
5model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7text = "There is a girl who likes adventure,"
8text = "Once upon a time,"
9inputs = tokenizer(text, return_tensors="pt").to(model.device)
10print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50, do_sample=False)[0]))
11##There is a girl who likes adventure, she is always looking for new things to do. She is very adventurous and loves to try new things. She is always looking for new things to do and is always looking for new things to try. She is always looking for new things to do and
12
13##Once upon a time, there was a young boy named Jack. He lived in a small village in England. Jack was very curious and loved to explore the world around him. One day, he decided to go on a journey to find a magical tree that could grant him three
14lm_eval --model hf --model_args pretrained="Intel/Qwen2-1.5B-Instuct-int4-inc" --device cuda:0 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,arc_easy,arc_challenge,mmlu --batch_size 16| Metric-1.5B-instruct | BF16 | INT4 |
|---|---|---|
| Avg | 0.5518 | 0.5474 |
| mmlu | 0.5565 | 0.5499 |
| lambada_openai | 0.6484 | 0.6412 |
| hellaswag | 0.4935 | 0.4859 |
| winogrande | 0.6543 | 0.6606 |
| piqa | 0.7612 | 0.7573 |
| truthfulqa_mc1 | 0.2827 | 0.2766 |
| openbookqa | 0.2780 | 0.274 |
| boolq | 0.7654 | 0.7639 |
| arc_easy | 0.7024 | 0.6949 |
| arc_challenge | 0.3754 | 0.3695 |
1git clone https://github.com/intel/auto-round
2cd auto-round/examples/language-modeling
3pip install -r requirements.txt
4python3 main.py \
5--model_name Qwen/Qwen2-1.5B-Instruct \
6--device 0 \
7--group_size 32 \
8--bits 4 \
9--sym \
10--iter 1000 \
11--deployment_device 'gpu' \
12--output_dir "./tmp_autoround"