lvkaokao
commited on
Commit
•
f77fd91
1
Parent(s):
80f0a05
add model.
Browse files- README.md +98 -3
- autoround-model-4bit-128g.safetensors +3 -0
- config.json +26 -0
- quantize_config.json +13 -0
- special_tokens_map.json +28 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +46 -0
README.md
CHANGED
@@ -1,3 +1,98 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
## Model Details: Neural-Chat-v3-1-int4-inc
|
4 |
+
|
5 |
+
This model is an int4 model with group_size 128 of [Intel/neural-chat-7b-v3-1](https://huggingface.co/Intel/neural-chat-7b-v3-1) generated by [intel/auto-round](https://github.com/intel/auto-round).
|
6 |
+
|
7 |
+
## How To Use
|
8 |
+
|
9 |
+
### Reproduce the model
|
10 |
+
|
11 |
+
Here is the sample command to reproduce the model
|
12 |
+
|
13 |
+
```bash
|
14 |
+
git clone https://github.com/intel/auto-round
|
15 |
+
cd auto-round
|
16 |
+
pip install -r requirements.txt
|
17 |
+
cd examples/language-modeling
|
18 |
+
pip install -r requirements.txt
|
19 |
+
python3 main.py \
|
20 |
+
--model_name Intel/neural-chat-7b-v3-1 \
|
21 |
+
--device 0 \
|
22 |
+
--group_size 128 \
|
23 |
+
--bits 4 \
|
24 |
+
--iters 1000 \
|
25 |
+
--enable_minmax_tuning \
|
26 |
+
--minmax_lr 0.0002 \
|
27 |
+
--deployment_device 'gpu' \
|
28 |
+
--scale_dtype 'fp32' \
|
29 |
+
--eval_bs 32 \
|
30 |
+
--output_dir "./tmp_autoround" \
|
31 |
+
--amp
|
32 |
+
|
33 |
+
```
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
### Use the model
|
38 |
+
|
39 |
+
### INT4 Inference with AutoGPTQ
|
40 |
+
|
41 |
+
Install [AutoGPTQ](https://github.com/AutoGPTQ/AutoGPTQ) from source first
|
42 |
+
|
43 |
+
```python
|
44 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
45 |
+
quantized_model_dir = "Intel/neural-chat-v3-1-int4-inc"
|
46 |
+
model = AutoModelForCausalLM.from_pretrained(quantized_model_dir,
|
47 |
+
device_map="auto",
|
48 |
+
trust_remote_code=False,
|
49 |
+
)
|
50 |
+
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, use_fast=True)
|
51 |
+
print(tokenizer.decode(model.generate(**tokenizer("There is a girl who likes adventure,", return_tensors="pt").to(model.device),max_new_tokens=50)[0]))
|
52 |
+
```
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
### Evaluate the model
|
57 |
+
|
58 |
+
Install [lm-eval-harness](https://github.com/EleutherAI/lm-evaluation-harness.git) from source, we used the git id f3b7917091afba325af3980a35d8a6dcba03dc3f
|
59 |
+
|
60 |
+
~~bash
|
61 |
+
lm_eval --model hf --model_args pretrained="Intel/neural-chat-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 --batch_size 128
|
62 |
+
~~
|
63 |
+
|
64 |
+
| Metric | FP16 | INT4 | qdq |
|
65 |
+
| -------------- | ------ | ------ | ------ |
|
66 |
+
| Avg. | 0.6769 | 0.6721 | 0.6718 |
|
67 |
+
| mmlu | 0.5919 | 0.5862 | 0.5863 |
|
68 |
+
| lambada_openai | 0.7394 | 0.7337 | 0.7334 |
|
69 |
+
| hellaswag | 0.6323 | 0.6272 | 0.6267 |
|
70 |
+
| winogrande | 0.7687 | 0.7577 | 0.7577 |
|
71 |
+
| piqa | 0.8161 | 0.8150 | 0.8150 |
|
72 |
+
| truthfulqa_mc1 | 0.4431 | 0.4394 | 0.4382 |
|
73 |
+
| openbookqa | 0.3760 | 0.3700 | 0.3680 |
|
74 |
+
| boolq | 0.8783 | 0.8743 | 0.8743 |
|
75 |
+
| rte | 0.7690 | 0.7726 | 0.7726 |
|
76 |
+
| arc_easy | 0.8413 | 0.8384 | 0.8388 |
|
77 |
+
| arc_challenge | 0.5896 | 0.5785 | 0.5785 |
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
## Ethical Considerations and Limitations
|
82 |
+
|
83 |
+
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
|
84 |
+
|
85 |
+
Therefore, before deploying any applications of the model, developers should perform safety testing.
|
86 |
+
|
87 |
+
## Caveats and Recommendations
|
88 |
+
|
89 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
|
90 |
+
|
91 |
+
Here are a couple of useful links to learn more about Intel's AI software:
|
92 |
+
|
93 |
+
* Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
|
94 |
+
* Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
|
95 |
+
|
96 |
+
## Disclaimer
|
97 |
+
|
98 |
+
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.
|
autoround-model-4bit-128g.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dde6b20027143acc058401cd82f4c3cd5cfc68d61d91785535b972cbd805d4a4
|
3 |
+
size 4158662256
|
config.json
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/models/neural-chat-7b-v3-1",
|
3 |
+
"architectures": [
|
4 |
+
"MistralForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 1,
|
8 |
+
"eos_token_id": 2,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 4096,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 14336,
|
13 |
+
"max_position_embeddings": 32768,
|
14 |
+
"model_type": "mistral",
|
15 |
+
"num_attention_heads": 32,
|
16 |
+
"num_hidden_layers": 32,
|
17 |
+
"num_key_value_heads": 8,
|
18 |
+
"rms_norm_eps": 1e-05,
|
19 |
+
"rope_theta": 10000.0,
|
20 |
+
"sliding_window": 4096,
|
21 |
+
"tie_word_embeddings": false,
|
22 |
+
"torch_dtype": "float16",
|
23 |
+
"transformers_version": "4.37.2",
|
24 |
+
"use_cache": true,
|
25 |
+
"vocab_size": 32000
|
26 |
+
}
|
quantize_config.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bits": 4,
|
3 |
+
"group_size": 128,
|
4 |
+
"damp_percent": 0.01,
|
5 |
+
"desc_act": false,
|
6 |
+
"static_groups": false,
|
7 |
+
"sym": false,
|
8 |
+
"true_sequential": false,
|
9 |
+
"model_name_or_path": null,
|
10 |
+
"model_file_base_name": "autoround-model-4bit-128g",
|
11 |
+
"is_marlin_format": false,
|
12 |
+
"quant_method": "intel/auto-round"
|
13 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": [
|
3 |
+
"<unk>",
|
4 |
+
"<s>",
|
5 |
+
"</s>"
|
6 |
+
],
|
7 |
+
"bos_token": {
|
8 |
+
"content": "<s>",
|
9 |
+
"lstrip": false,
|
10 |
+
"normalized": false,
|
11 |
+
"rstrip": false,
|
12 |
+
"single_word": false
|
13 |
+
},
|
14 |
+
"eos_token": {
|
15 |
+
"content": "</s>",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": false,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false
|
20 |
+
},
|
21 |
+
"unk_token": {
|
22 |
+
"content": "<unk>",
|
23 |
+
"lstrip": false,
|
24 |
+
"normalized": false,
|
25 |
+
"rstrip": false,
|
26 |
+
"single_word": false
|
27 |
+
}
|
28 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
|
3 |
+
size 493443
|
tokenizer_config.json
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"added_tokens_decoder": {
|
5 |
+
"0": {
|
6 |
+
"content": "<unk>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false,
|
11 |
+
"special": true
|
12 |
+
},
|
13 |
+
"1": {
|
14 |
+
"content": "<s>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": false,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false,
|
19 |
+
"special": true
|
20 |
+
},
|
21 |
+
"2": {
|
22 |
+
"content": "</s>",
|
23 |
+
"lstrip": false,
|
24 |
+
"normalized": false,
|
25 |
+
"rstrip": false,
|
26 |
+
"single_word": false,
|
27 |
+
"special": true
|
28 |
+
}
|
29 |
+
},
|
30 |
+
"additional_special_tokens": [
|
31 |
+
"<unk>",
|
32 |
+
"<s>",
|
33 |
+
"</s>"
|
34 |
+
],
|
35 |
+
"bos_token": "<s>",
|
36 |
+
"clean_up_tokenization_spaces": false,
|
37 |
+
"eos_token": "</s>",
|
38 |
+
"legacy": true,
|
39 |
+
"model_max_length": 1000000000000000019884624838656,
|
40 |
+
"pad_token": null,
|
41 |
+
"sp_model_kwargs": {},
|
42 |
+
"spaces_between_special_tokens": false,
|
43 |
+
"tokenizer_class": "LlamaTokenizer",
|
44 |
+
"unk_token": "<unk>",
|
45 |
+
"use_default_system_prompt": true
|
46 |
+
}
|