wenhuach commited on
Commit
6847ba6
1 Parent(s): 23105ef

first commit

Browse files

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

README.md CHANGED
@@ -1,3 +1,102 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Model Details
2
+
3
+ This model is an int4 model with group_size 32 sym of [Qwen/Qwen2-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2-1.5B-Instruct) generated by [intel/auto-round](https://github.com/intel/auto-round), we will generate group_size 128 later
4
+
5
+ ## How To Use
6
+
7
+ ### INT4 Inference with AutoGPTQ
8
+
9
+
10
+
11
+ ```python
12
+ ##pip install auto-gptq==0.7.1
13
+ from transformers import AutoModelForCausalLM,AutoTokenizer
14
+ quantized_model_dir = "Intel/Qwen2-1.5B-Insturct-int4-inc"
15
+ tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
16
+ model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
17
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
18
+ text = "There is a girl who likes adventure,"
19
+ text = "Once upon a time,"
20
+ inputs = tokenizer(text, return_tensors="pt").to(model.device)
21
+ print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50, do_sample=False)[0]))
22
+ ##There is a girl who likes adventure, she is always looking for new things to do. She is very adventurous and loves to try new things. She is always looking for new things to do and is always looking for new things to try. She is always looking for new things to do and
23
+
24
+ ##Once upon a time, there was a young boy named Jack. He lived in a small village in England. Jack was very curious and loved to explore the world around him. One day, he decided to go on a journey to find a magical tree that could grant him three
25
+
26
+ ```
27
+
28
+
29
+
30
+ ### Evaluate the model
31
+
32
+ pip3 install lm-eval==0.4.2
33
+
34
+ ```bash
35
+ lm_eval --model hf --model_args pretrained="Intel/Qwen2-1.5B-Instuct-int4-inc" --device cuda:0 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,arc_easy,arc_challenge,mmlu --batch_size 16
36
+ ```
37
+
38
+
39
+
40
+ | Metric-1.5B-instruct | BF16 | W4G32 sym |
41
+ | -------------------- | ------ | --------- |
42
+ | Avg | 0.5518 | 0.5474 |
43
+ | mmlu | 0.5565 | 0.5499 |
44
+ | lambada_openai | 0.6484 | 0.6412 |
45
+ | hellaswag | 0.4935 | 0.4859 |
46
+ | winogrande | 0.6543 | 0.6606 |
47
+ | piqa | 0.7612 | 0.7573 |
48
+ | truthfulqa_mc1 | 0.2827 | 0.2766 |
49
+ | openbookqa | 0.2780 | 0.274 |
50
+ | boolq | 0.7654 | 0.7639 |
51
+ | arc_easy | 0.7024 | 0.6949 |
52
+ | arc_challenge | 0.3754 | 0.3695 |
53
+
54
+
55
+
56
+ ### Reproduce the model
57
+
58
+ Here is the sample command to reproduce the model
59
+
60
+ ```bash
61
+ git clone https://github.com/intel/auto-round
62
+ cd auto-round/examples/language-modeling
63
+ pip install -r requirements.txt
64
+ python3 main.py \
65
+ --model_name Qwen/Qwen2-1.5B-Instruct \
66
+ --device 0 \
67
+ --group_size 32 \
68
+ --bits 4 \
69
+ --sym \
70
+ --iter 1000 \
71
+ --deployment_device 'gpu' \
72
+ --output_dir "./tmp_autoround"
73
+ ```
74
+
75
+
76
+
77
+ ## Ethical Considerations and Limitations
78
+
79
+ 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.
80
+
81
+ Therefore, before deploying any applications of the model, developers should perform safety testing.
82
+
83
+ ## Caveats and Recommendations
84
+
85
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
86
+
87
+ Here are a couple of useful links to learn more about Intel's AI software:
88
+
89
+ * Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
90
+ * Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
91
+
92
+ ## Disclaimer
93
+
94
+ 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.
95
+
96
+
97
+
98
+ ## Cite
99
+
100
+ @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 and Liu, Yi}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }
101
+
102
+ [arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)
added_tokens.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "<|endoftext|>": 151643,
3
+ "<|im_end|>": 151645,
4
+ "<|im_start|>": 151644
5
+ }
config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/models/Qwen2-1.5B-Instruct",
3
+ "architectures": [
4
+ "Qwen2ForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "eos_token_id": 151645,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 1536,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 8960,
13
+ "max_position_embeddings": 32768,
14
+ "max_window_layers": 21,
15
+ "model_type": "qwen2",
16
+ "num_attention_heads": 12,
17
+ "num_hidden_layers": 28,
18
+ "num_key_value_heads": 2,
19
+ "quantization_config": {
20
+ "autoround_version": "0.2.1.dev",
21
+ "bits": 4,
22
+ "damp_percent": 0.01,
23
+ "desc_act": false,
24
+ "enable_minmax_tuning": true,
25
+ "enable_quanted_input": true,
26
+ "group_size": 32,
27
+ "is_marlin_format": false,
28
+ "iters": 1000,
29
+ "lr": 0.001,
30
+ "minmax_lr": 0.001,
31
+ "model_file_base_name": "model",
32
+ "model_name_or_path": null,
33
+ "quant_method": "gptq",
34
+ "scale_dtype": "float16",
35
+ "static_groups": false,
36
+ "sym": true,
37
+ "true_sequential": false
38
+ },
39
+ "rms_norm_eps": 1e-06,
40
+ "rope_theta": 1000000.0,
41
+ "sliding_window": 32768,
42
+ "tie_word_embeddings": true,
43
+ "torch_dtype": "bfloat16",
44
+ "transformers_version": "4.40.0",
45
+ "use_cache": true,
46
+ "use_sliding_window": false,
47
+ "vocab_size": 151936
48
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f22fd4f4bfa905c4f983cad04d07b8bff73a3f364c6f4807e97ee51ea4e148a
3
+ size 1694567560
quantize_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 4,
3
+ "group_size": 32,
4
+ "damp_percent": 0.01,
5
+ "desc_act": false,
6
+ "static_groups": false,
7
+ "sym": true,
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
+ "autoround_version": "0.2.1.dev",
14
+ "iters": 1000,
15
+ "lr": 0.001,
16
+ "minmax_lr": 0.001,
17
+ "enable_minmax_tuning": true,
18
+ "enable_quanted_input": true,
19
+ "scale_dtype": "float16"
20
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>"
5
+ ],
6
+ "eos_token": {
7
+ "content": "<|im_end|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false
12
+ },
13
+ "pad_token": {
14
+ "content": "<|endoftext|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false
19
+ }
20
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "151643": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "151644": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "151645": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ }
28
+ },
29
+ "additional_special_tokens": [
30
+ "<|im_start|>",
31
+ "<|im_end|>"
32
+ ],
33
+ "bos_token": null,
34
+ "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
35
+ "clean_up_tokenization_spaces": false,
36
+ "eos_token": "<|im_end|>",
37
+ "errors": "replace",
38
+ "model_max_length": 32768,
39
+ "pad_token": "<|endoftext|>",
40
+ "split_special_tokens": false,
41
+ "tokenizer_class": "Qwen2Tokenizer",
42
+ "unk_token": null
43
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff