Views
No views yet
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 mistralai/Mistral-7B-v0.1 \
6--device 0 \
7--group_size 128 \
8--bits 4 \
9--iters 1000 \
10--quant_lm_head \
11--disable_low_gpu_mem_usage \
12--deployment_device 'gpu' \
13--output_dir "./tmp_autoround"
141from transformers import AutoModelForCausalLM, AutoTokenizer
2from auto_round.auto_quantizer import AutoHfQuantizer
3quantized_model_dir = "Intel/Mistral-7B-v0.1-int4-inc-lmhead"
4model = AutoModelForCausalLM.from_pretrained(quantized_model_dir,
5 device_map="auto",
6 trust_remote_code=False,
7 )
8tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, use_fast=True)
9print(tokenizer.decode(model.generate(**tokenizer("There is a girl who likes adventure,", return_tensors="pt").to(model.device),max_new_tokens=50)[0]))1git clone https://github.com/intel/auto-round
2cd auto-round/examples/language-modeling
3python3 eval_042/evluation.py --model_name "Intel/Mistral-7B-v0.1-int4-inc-lmhead" --eval_bs 32| Metric | BF16 | INT4-lmhead | INT4 |
|---|---|---|---|
| Avg. | 0.6260 | 0.6228 | 0.6218 |
| mmlu | 0.5868 | 0.5760 | 0.5772 |
| lambada_openai | 0.7555 | 0.7539 | 0.7543 |
| hellaswag | 0.6125 | 0.6055 | 0.6072 |
| winogrande | 0.7395 | 0.7380 | 0.7388 |
| piqa | 0.8069 | 0.8009 | 0.8030 |
| truthfulqa_mc1 | 0.2803 | 0.2876 | 0.2864 |
| openbookqa | 0.3280 | 0.3300 | 0.3260 |
| boolq | 0.8379 | 0.8291 | 0.8281 |
| arc_easy | 0.8089 | 0.8043 | 0.8035 |
| arc_challenge | 0.5034 | 0.5026 | 0.4932 |