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 Intel/neural-chat-7b-v3-1 \
6--device 0 \
7--group_size 128 \
8--bits 4 \
9--iters 1000 \
10--enable_minmax_tuning \
11--disable_quanted_input \
12--minmax_lr 0.002 \
13--deployment_device 'gpu' \
14--scale_dtype 'fp32' \
15--eval_bs 32 \
16--output_dir "./tmp_autoround" \
17--amp
181from intel_extension_for_transformers.transformers import AutoModelForCausalLM
2from transformers import AutoTokenizer
3quantized_model_dir = "Intel/neural-chat-7b-v3-1-int4-inc"
4model = AutoModelForCausalLM.from_pretrained(quantized_model_dir,
5 device_map="auto",
6 trust_remote_code=False,
7 use_neural_speed=False,
8 )
9tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, use_fast=True)
10print(tokenizer.decode(model.generate(**tokenizer("There is a girl who likes adventure,", return_tensors="pt").to(model.device),max_new_tokens=50)[0]))
11"""
12 <s> There is a girl who likes adventure, who loves to travel, who is always looking for new experiences. She is a dreamer, a doer, a thinker, a believer. She is a girl who is not afraid to take risks, to make mistakes, to learn from
13"""1from transformers import AutoModelForCausalLM, AutoTokenizer
2quantized_model_dir = "Intel/neural-chat-7b-v3-1-int4-inc"
3model = AutoModelForCausalLM.from_pretrained(quantized_model_dir,
4 device_map="auto",
5 trust_remote_code=False,
6 )
7tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, use_fast=True)
8print(tokenizer.decode(model.generate(**tokenizer("There is a girl who likes adventure,", return_tensors="pt").to(model.device),max_new_tokens=50)[0]))lm_eval --model hf --model_args pretrained="Intel/neural-chat-7b-v3-1-int4-inc",autogptq=True,gptq_use_triton=True --device cuda:0 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,rte,arc_easy,arc_challenge,mmlu --batch_size 128| Metric | FP16 | INT4 |
|---|---|---|
| Avg. | 0.6769 | 0.6721 |
| mmlu | 0.5919 | 0.5862 |
| lambada_openai | 0.7394 | 0.7337 |
| hellaswag | 0.6323 | 0.6272 |
| winogrande | 0.7687 | 0.7577 |
| piqa | 0.8161 | 0.8150 |
| truthfulqa_mc1 | 0.4431 | 0.4394 |
| openbookqa | 0.3760 | 0.3700 |
| boolq | 0.8783 | 0.8743 |
| rte | 0.7690 | 0.7726 |
| arc_easy | 0.8413 | 0.8384 |
| arc_challenge | 0.5896 | 0.5785 |