wenhuach commited on
Commit
3dd4a87
1 Parent(s): 7f62e5c

first commit

Browse files
README.md CHANGED
@@ -1,3 +1,96 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ## Model Details: Mistral-7B-v0.1-int4-inc
4
+
5
+ This model is an int4 model with group_size 128 of [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.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/examples/language-modeling
16
+ pip install -r requirements.txt
17
+ python3 main.py \
18
+ --model_name mistralai/Mistral-7B-v0.1 \
19
+ --device 0 \
20
+ --group_size 128 \
21
+ --bits 4 \
22
+ --iters 1000 \
23
+ --enable_minmax_tuning \
24
+ --use_quant_input \
25
+ --deployment_device 'gpu' \
26
+ --scale_dtype 'fp32' \
27
+ --eval_bs 32 \
28
+ --output_dir "./tmp_autoround" \
29
+ --amp
30
+
31
+ ```
32
+
33
+
34
+
35
+ ### Use the model
36
+
37
+ ### INT4 Inference with AutoGPTQ
38
+
39
+ Install [AutoGPTQ](https://github.com/AutoGPTQ/AutoGPTQ) from source first
40
+
41
+ ```python
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+ quantized_model_dir = "Intel/Mistral-7B-v0.1-int4-inc"
44
+ model = AutoModelForCausalLM.from_pretrained(quantized_model_dir,
45
+ device_map="auto",
46
+ trust_remote_code=False,
47
+ )
48
+ tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, use_fast=True)
49
+ print(tokenizer.decode(model.generate(**tokenizer("There is a girl who likes adventure,", return_tensors="pt").to(model.device),max_new_tokens=50)[0]))
50
+ ```
51
+
52
+
53
+
54
+ ### Evaluate the model
55
+
56
+ Install [lm-eval-harness](https://github.com/EleutherAI/lm-evaluation-harness.git) from source, we used the git id f3b7917091afba325af3980a35d8a6dcba03dc3f
57
+
58
+ ~~bash
59
+ lm_eval --model hf --model_args pretrained="Intel/Mistral-7B-v0.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
60
+ ~~
61
+
62
+ | Metric | FP16 | INT4 |
63
+ | -------------- | ------ | ------ |
64
+ | Avg. | 0.6306 | 0.6308 |
65
+ | mmlu | 0.5961 | 0.5880 |
66
+ | lambada_openai | 0.7561 | 0.7551 |
67
+ | hellaswag | 0.6128 | 0.6079 |
68
+ | winogrande | 0.7443 | 0.7451 |
69
+ | piqa | 0.8079 | 0.8014 |
70
+ | truthfulqa_mc1 | 0.2803 | 0.2889 |
71
+ | openbookqa | 0.3280 | 0.3300 |
72
+ | boolq | 0.8373 | 0.8278 |
73
+ | rte | 0.6643 | 0.6968 |
74
+ | arc_easy | 0.8085 | 0.8060 |
75
+ | arc_challenge | 0.5009 | 0.4915 |
76
+
77
+
78
+
79
+ ## Ethical Considerations and Limitations
80
+
81
+ 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.
82
+
83
+ Therefore, before deploying any applications of the model, developers should perform safety testing.
84
+
85
+ ## Caveats and Recommendations
86
+
87
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
88
+
89
+ Here are a couple of useful links to learn more about Intel's AI software:
90
+
91
+ * Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
92
+ * Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
93
+
94
+ ## Disclaimer
95
+
96
+ 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.
config.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/models/Mistral-7B-v0.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
+ "quantization_config": {
19
+ "bits": 4,
20
+ "damp_percent": 0.01,
21
+ "desc_act": false,
22
+ "enable_minmax_tuning": true,
23
+ "group_size": 128,
24
+ "is_marlin_format": false,
25
+ "iters": 1000,
26
+ "lr": 0.001,
27
+ "minmax_lr": 0.001,
28
+ "model_file_base_name": "model",
29
+ "model_name_or_path": null,
30
+ "quant_method": "gptq",
31
+ "static_groups": false,
32
+ "sym": false,
33
+ "true_sequential": false,
34
+ "use_quant_input": true,
35
+ "version": "0.1"
36
+ },
37
+ "rms_norm_eps": 1e-05,
38
+ "rope_theta": 10000.0,
39
+ "sliding_window": 4096,
40
+ "tie_word_embeddings": false,
41
+ "torch_dtype": "bfloat16",
42
+ "transformers_version": "4.37.2",
43
+ "use_cache": true,
44
+ "vocab_size": 32000
45
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31dc412aabad01e77ad6526794355a107ebacc50abda9b2f17d25e8a33413dfb
3
+ size 4158662312
quantize_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "model",
11
+ "is_marlin_format": false,
12
+ "quant_method": "intel/auto-round",
13
+ "version": "0.1",
14
+ "iters": 1000,
15
+ "lr": 0.001,
16
+ "minmax_lr": 0.001,
17
+ "enable_minmax_tuning": true,
18
+ "use_quant_input": true
19
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
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,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "bos_token": "<s>",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "legacy": true,
35
+ "model_max_length": 1000000000000000019884624838656,
36
+ "pad_token": null,
37
+ "sp_model_kwargs": {},
38
+ "spaces_between_special_tokens": false,
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": true
42
+ }