wenhuach commited on
Commit
122433d
1 Parent(s): 44a043e

first commit

Browse files

Signed-off-by: wenhuach <wenhuach87@gmail.com>

README.md CHANGED
@@ -1,3 +1,95 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ## Model Details: Mistral-7B-v0.1-int4-inc-lmhead
4
+
5
+ This model is an int4 model with group_size 128 and quantized lmhead 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
+ --quant_lm_head \
24
+ --disable_low_gpu_mem_usage \
25
+ --deployment_device 'gpu' \
26
+ --output_dir "./tmp_autoround"
27
+
28
+ ```
29
+
30
+
31
+
32
+ ### Use the model
33
+
34
+ pip install auto-gptq
35
+
36
+ Install auto-round from source first
37
+
38
+ ```python
39
+ from transformers import AutoModelForCausalLM, AutoTokenizer
40
+ from auto_round.export import AutoHfQuantizer
41
+ quantized_model_dir = "Intel/Mistral-7B-v0.1-int4-inc-lmhead"
42
+ model = AutoModelForCausalLM.from_pretrained(quantized_model_dir,
43
+ device_map="auto",
44
+ trust_remote_code=False,
45
+ )
46
+ tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, use_fast=True)
47
+ print(tokenizer.decode(model.generate(**tokenizer("There is a girl who likes adventure,", return_tensors="pt").to(model.device),max_new_tokens=50)[0]))
48
+ ```
49
+
50
+
51
+
52
+ ### Evaluate the model
53
+
54
+ pip install lm-eval==0.4.2
55
+
56
+ ```bash
57
+ git clone https://github.com/intel/auto-round
58
+ cd auto-round/examples/language-modeling
59
+ python3 eval_042/evluation.py --model_name "Intel/Mistral-7B-v0.1-int4-inc-lmhead" --eval_bs 32
60
+ ```
61
+
62
+
63
+
64
+ | Metric | BF16 | INT4-lmhead | [INT4](https://huggingface.co/Intel/Mistral-7B-v0.1-int4-inc) |
65
+ | -------------- | ------ | ----------- | ------------------------------------------------------------ |
66
+ | Avg. | 0.6260 | 0.6228 | 0.6218 |
67
+ | mmlu | 0.5868 | 0.5760 | 0.5772 |
68
+ | lambada_openai | 0.7555 | 0.7539 | 0.7543 |
69
+ | hellaswag | 0.6125 | 0.6055 | 0.6072 |
70
+ | winogrande | 0.7395 | 0.7380 | 0.7388 |
71
+ | piqa | 0.8069 | 0.8009 | 0.8030 |
72
+ | truthfulqa_mc1 | 0.2803 | 0.2876 | 0.2864 |
73
+ | openbookqa | 0.3280 | 0.3300 | 0.3260 |
74
+ | boolq | 0.8379 | 0.8291 | 0.8281 |
75
+ | arc_easy | 0.8089 | 0.8043 | 0.8035 |
76
+ | arc_challenge | 0.5034 | 0.5026 | 0.4932 |
77
+
78
+ ## Ethical Considerations and Limitations
79
+
80
+ 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.
81
+
82
+ Therefore, before deploying any applications of the model, developers should perform safety testing.
83
+
84
+ ## Caveats and Recommendations
85
+
86
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
87
+
88
+ Here are a couple of useful links to learn more about Intel's AI software:
89
+
90
+ * Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
91
+ * Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
92
+
93
+ ## Disclaimer
94
+
95
+ 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,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "amp": true,
20
+ "autoround_version": "0.2.0.dev",
21
+ "backend": "gptq:exllamav2",
22
+ "bits": 4,
23
+ "data_type": "int",
24
+ "dataset": "NeelNanda/pile-10k",
25
+ "enable_minmax_tuning": true,
26
+ "enable_quanted_input": true,
27
+ "extra_config": {
28
+ "lm_head": {
29
+ "bits": 4,
30
+ "data_type": "int",
31
+ "group_size": 128,
32
+ "sym": false
33
+ }
34
+ },
35
+ "gradient_accumulate_steps": 1,
36
+ "group_size": 128,
37
+ "iters": 1000,
38
+ "lr": 0.001,
39
+ "minmax_lr": 0.001,
40
+ "quant_method": "intel/auto-round",
41
+ "scale_dtype": "torch.float16",
42
+ "seqlen": 2048,
43
+ "sym": false,
44
+ "train_bs": 8
45
+ },
46
+ "rms_norm_eps": 1e-05,
47
+ "rope_theta": 10000.0,
48
+ "sliding_window": 4096,
49
+ "tie_word_embeddings": false,
50
+ "torch_dtype": "bfloat16",
51
+ "transformers_version": "4.40.2",
52
+ "use_cache": true,
53
+ "vocab_size": 32000
54
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.40.2"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dd7f8a6b06e58defcabbc8ec497273c7629f6749a641074d6b52af1da1cf33e
3
+ size 3961854288
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
+ }