Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,88 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- NeelNanda/pile-10k
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
---
|
8 |
+
|
9 |
+
|
10 |
+
## Model Details
|
11 |
+
|
12 |
+
This model is an int4 model with group_size 128 of [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) generated by [intel/auto-round](https://github.com/intel/auto-round).
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
### INT4 Inference with AutoGPTQ's Kernel
|
17 |
+
|
18 |
+
```python
|
19 |
+
##pip install auto-gptq[triton]
|
20 |
+
##pip install triton==2.2.0
|
21 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
22 |
+
quantized_model_dir = "Intel/gpt-neox-20b-int4-inc"
|
23 |
+
model = AutoModelForCausalLM.from_pretrained(quantized_model_dir,
|
24 |
+
device_map="auto",
|
25 |
+
trust_remote_code=False,
|
26 |
+
)
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, use_fast=True)
|
28 |
+
print(tokenizer.decode(model.generate(**tokenizer("There is a girl who likes adventure,", return_tensors="pt").to(model.device),max_new_tokens=50)[0]))
|
29 |
+
```
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
### Evaluate the model
|
34 |
+
|
35 |
+
Install [lm-eval-harness](https://github.com/EleutherAI/lm-evaluation-harness.git) from source, we used the git id 96d185fa6232a5ab685ba7c43e45d1dbb3bb906d
|
36 |
+
|
37 |
+
```bash
|
38 |
+
lm_eval --model hf --model_args pretrained="Intel/gpt-neox-20b-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 32
|
39 |
+
```
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
### Reproduce the model
|
44 |
+
|
45 |
+
Here is the sample command to reproduce the model
|
46 |
+
|
47 |
+
```bash
|
48 |
+
git clone https://github.com/intel/auto-round
|
49 |
+
cd auto-round/examples/language-modeling
|
50 |
+
pip install -r requirements.txt
|
51 |
+
python3 main.py \
|
52 |
+
--model_name EleutherAI/gpt-neox-20b \
|
53 |
+
--device 0 \
|
54 |
+
--group_size 128 \
|
55 |
+
--bits 4 \
|
56 |
+
--iters 1000 \
|
57 |
+
--deployment_device 'gpu' \
|
58 |
+
--disable_quanted_input \
|
59 |
+
--minmax_lr 2e-3 \
|
60 |
+
--output_dir "./tmp_autoround" \
|
61 |
+
|
62 |
+
```
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
## Caveats and Recommendations
|
68 |
+
|
69 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
|
70 |
+
|
71 |
+
Here are a couple of useful links to learn more about Intel's AI software:
|
72 |
+
|
73 |
+
* Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
|
74 |
+
* Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
## Disclaimer
|
79 |
+
|
80 |
+
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
## Cite
|
85 |
+
|
86 |
+
@article{cheng2023optimize, title={Optimize weight rounding via signed gradient descent for the quantization of llms}, author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }
|
87 |
+
|
88 |
+
[arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)
|